Bilaam desperately wanted to destroy the nation of Israel. The midrash quoted by Rashi teaches that he hated Israel even more than Balak, the king who hired him. Balak only wished to chase the Jews from his area (ואגרשנו מן הארץ), while Bilaam planned to wipe them off the globe.
And so, Bilaam set out, and with the help of Balak, tried time and again to curse the Jews. However, each attempt was thwarted by God, who withheld his mystical moment of anger each day (See Brachoth 7a), and forced a blessing out of the mouth of the evil prophet. In one instance, Bilaam was inspired by the privacy each Jewish home provided its neighbors, by having windows that specifically faced away from other homes windows. In another, the prophet described the Jews as a nation that dwells unto itself.
Balak saw Israel's strength precisely in their ability to draw distinctions and boundaries between things that need to be separate. This is, in fact, one explanation of the symbolism behind שעטנז and the dietary laws, according to Rabbi Hirsch. The Beit Halevi says that man's ability to preserve physical distinctions like keeping meat and milk separate is a reason that the Torah was given to us, and not to angels. The maintenance of boundaries that God sets, both in the natural law (ex. כלאיים) and in the moral Law He delivered at Sinai (ex. שעטנז and בשר בחלב), is a major task given to Israel. By doing so, we bow to His greater wisdom, and keep order in this world. Keeping this in mind, Israel has the capacity to become a shining city atop a hill, and lead the world towards God by example of a perfect society. A light unto the nations must dwell apart from them, to provide a goal and structure.
Indeed, the order that God placed in nature is a model for the order that exists in morals and ethics. Just as it is naturally wrong to place an ox and a ram in a yoke together, causing them both stress and pain because of their different gaits, so it is morally wrong to blur the line between what is mine and what is my fellow man's.
The Jewish nation was able to maintain their aloof nobility in the face of Bilaam's attempts to curse them. In fact, throughout history, our nation demonstrates the ability to keep its distance when threatened with hate and rage from the nations. However, Bilaam realized after three attempts, that his very blessings to the Jews were their Achilles' heel.
And so, Bilaam decides to change tactics. Instead of threatening the Jews openly, he decides to help them blur the line between Jew and Midianite, between morality and sin. He sends girls to seduce the Jews. Acceptance and toleration are experiences that cause Jews to lose the demarcations that God's law demands. Sin ensues, and the spiritual walls of protection have been breached.
Throughout the generations, Bilaam's blessings and scheming serve to remind us of the two sides of the same coin. Boundaries, natural and moral, allow Israel to fulfill its national calling, bringing spirituality and שכינה into this world. The blurring of these boundaries ultimately leads Mankind astray, and disaster follows closely in the wake.
When Israel recognizes its uniqueness and destiny in the scheme of history, it will proudly march before the nations, bringing them to an awe-filled appreciation for Godliness. As the Talmud states (Yoma 86a), "ראו כמה נאים דרכיו כמה מתוקנים מעשיו עליו הכתוב אומר (ישעיהו מט) ויאמר לי עבדי אתה ישראל אשר בך אתפאר." May we all work to bring this realization to our whole nation, and bring about the fulfillment of our purpose as an אור לגוים.