As we have seen in the introduction to Massekhet Menaḥot, a kometz – a fistful of flour – was taken from most of the meal offerings that were brought in the Temple and was placed on the altar. The first Mishna teaches that in most cases, if this was done she-lo lishmah – with improper intentions – the meal offering remains a valid sacrifice, although it is not credited to the owner of the offering and he will have to bring a replacement for it.
Rashi explains that when the Mishna says that the kometz was taken with improper intentions it means that at the time that he took the fistful of flour the kohen stated clearly his incorrect intention regarding the kometz. The Rambam, however, indicates that even an inappropriate thought would be enough to affect the status of the offering. At the same time, in Massekhet Zevaḥim (daf 2b) it is clear that when bringing an animal sacrifice it is only if the kohen has the wrong intention that there will be a problem; if he does not have any specific thoughts, the korban will not be affected.
Our Gemara does not offer any source for the requirement that the meal offering be brought with appropriate intent. Tosafot suggest that the Mishna here relies on the rules that were taught regarding animal sacrifices in Massekhet Zevaḥim (see daf 4a) based on the passages about a korban shelamim – a peace offering – given the connection that the Torah makes among all sacrifices in Sefer Vayikra (7:37).
Some commentaries point out that although there is reason to suggest that there is a major difference between animal sacrifices – where changing a sacrifice from an ola (a burnt offering) to a shelamim (a peace offering) involves a transformation from one level of holiness to another and from one type of atonement to another – while all menaḥot are largely the same, nevertheless the Torah does distinguish between different menaḥot in the way they are prepared and gives them different names (see the introduction to this tractate).