Hashem put a word in Balaam's mouth, and said, "Return to Balak, and thus you shall speak."
The Ohr Hachaim says a beautiful explanation for this ד ב ר that was placed in the mouth of Bil’am. He writes that Hashem wished to reveal the secrets of the future of Klal Yisroel through Bil’am. Bil’am’s words were supposed to publicize Klal Yisroel's holiness among all the world's nations. His prophecy announced to the world what would take place at the end of days, and how Klal Yisroel would emerge triumphant from history’s hurricanes and horrors. Now the Gentiles would also know, from their prophets, that Klal Yisroel’s victory is assured, and that they were the chosen ones.
Bil’am was a most disgusting person, totally involved in wicked activities and proclivities. He was far worse than your regular person who doesn’t follow Torah laws; he was as immoral as a person could get, living a life of hedonism and depravity. There was no way that someone as impure and disgusting as he should be a partner in such a great Kiddush Hashem. The holy words of prophecy were not supposed to emerge from a mouth filled with filth like that of Bil’am. Even if he would have been an upstanding gentile, the lofty words of prophecy require a cleaner vessel than the mouth of a gentile.
Hashem came up with a trick to solve this problem. He didn’t want the holy words of prophecy to pass through the impure mouth of Bil’am, so he placed a protective piece in his mouth, that the words never pass through the piece, not the impure mouth of Bil’am.
The Ohr Hachaim now explains the possuk וַיָּשֶם ה' דָבָר בְּפִי בִלְעָם - Hashem placed a piece in the mouth of Bil’am, that would separate between the holy words emerging from his mouth and his impure filthy mouth. The Heavenly words of prophecy were no longer defiled by Bil’am’s mouth.
On a similar note, the Baal Shem Tov explains the words of the Targum. The possuk (Bamidbar 24:3) says נְאֻם הַגֶּבֶר שְתֻם הָעַיִן – the speech of the man with the stuffed eye. Bil’am was blind in one of his eyes. The Targum translates these last two words as גברא דשפיר חזי – the man who can see well. This seems incongruous, Bil’am’s stuffed eye should be the one that can see well?
The Baal Shem Tov explains that Bil’am had defiled his entire body with the most egregious of sins. Although there are people who commit adultery, Bil’am had defiled himself by bestiality, with his donkey. He was of the lowest of people, and his entire being was filth and impurity. Even though Hashem promised the gentiles that they too would have a prophet, how was it physically possible for someone like Bil’am, with his eyes, to perceive holy visions?
The answer is, Bil’am’s body had one undefiled corner. The one eye that could not see, could not sin. Even though his entire body had been utilized for evil nefarious purposes, there was one part of his body that could not sin, even if he wanted to. This bad eye was the one body part that could perceive the holy visions of prophecy that Bil’am had. The possuk calls him the stuffed eye, but the Targum reveals that this eye allowed him to experience the prophecies that he did.
