You may recall from Mitzvah #473 that maaser sheini, the second tithe, was meant to be eaten by its owners in Jerusalem. Here we are informed that one may not eat his maaser sheini in a state of aninus. (Biblically, aninus is just the day on which a close relative dies. Rabbinically, it is extended until the deceased has been buried.)
The Torah does not come out and say "thou shalt not" but the vidui maaser (see previous mitzvah) includes a statement that "I did not eat from it in my grieving," from which we easily infer that doing so is impermissible. (Similar to this, we see that Aaron, the High Priest, did not eat from sacrifices on the day his sons died and Moshe conceded that was, in fact, the halacha – see Leviticus chapter 10.)
The basis of this mitzvah is that maaser is holy and it doesn't mix well with mourning. An analog to this is when Mordechai was not allowed inside the king's gate wearing sackcloth (Esther 4:2). If one should not attend to mortal matters of state in a grieving condition, we certainly ought not to attend to the Divine in such condition. Additionally, the one who is grieving lacks the presence of mind to focus on properly performing his religious duties.
This mitzvah applies in Temple times. It is discussed in the Talmud in tractate Makkos (19b); in the Mishna, it is discussed in the fifth chapter of tractate Maaser Sheini. It is codified in the Mishneh Torah in the third chapter of Hilchos Maaser Sheini. This mitzvah is #151 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.