Berachos chapter 3, mishnah 4. This mishnah introduces us to the concept of a baal keri - a man who has had a seminal emission. According to Torah law such a person is tamei, and he becomes pure by immersing in a mikvah, and from that evening onward he is pure. That is the Torah law concerning a baal keri.
The Decree of Ezra:
The mishnah presents us with what we call 'the decree of Ezra': Ezra the Scribe enacted that a baal keri may not pray or say words of Torah. The Gemara teaches that in the end this decree was not kept by the Jewish people as a whole - the Sages determined that most of the community was unable to uphold it, and therefore they annulled it. Our mishnah, however, is speaking about the period when the decree was still in force, and it teaches us several of the rules that apply to it.
The Words of the Mishnah:
"Baal keri meharher b'libo" - one who has had an emission and has not yet immersed thinks the words of Shema in his heart instead of saying them out loud. He is permitted to think them, and he need not say them with his mouth.
"V'eino mevarech lo lifanehah v'lo l'achareha" - he does not recite the berachos of Shema, neither the berachos that come before it nor those that come after it, and not even by thinking them in his mind.
"V'al hamazon mevarech l'acharav v'eino mevarech l'fanav" - at a meal he recites the berachah that comes after eating, but he does not recite the berachah that comes before it. Here too, as we are explaining the mishnah, "recites" means only in thought.
The Basis of the Distinction - Torah Law and Rabbinic Law:
The difference between those obligations that he was required to fulfill in thought and those that he was not depends on whether they are Torah obligations or rabbinic ones:
Shema - a Torah obligation, and therefore he was required to fulfill it at least by way of thought.
Berachos that are rabbinic - like all berachos, including the berachos of Shema and the berachah before eating: the Sages did not require him to say them, not even in thought.
Birkas HaMazon - the berachah after eating, which is a Torah obligation, and therefore he was required to fulfill it at least by way of thought.
"Rabbi Yehudah omer: mevarech lifneihem v'l'achareihem" - in Rabbi Yehudah's view he recites both the berachos of Shema and the berachah before eating, and even with his mouth: he need not make do with thought alone, but may actually say them aloud.
In summary: in this mishnah we learned the laws of a baal keri in light of the decree of Ezra, which forbade him to pray or say words of Torah until he immerses - a decree that was later annulled because most of the community was not able to uphold it. The rule that emerges from the mishnah: the Torah obligations - Shema and Birkas HaMazon - a baal keri fulfills by thinking them in his heart, while the rabbinic berachos he does not say at all, not even in thought. Rabbi Yehudah disagrees and holds that he recites them even out loud, both before them and after them.