Well this one is a bit complex, and I was wondering how I would word it simply and consisely, so please forgive my tardiness.
I would remind us of the context of this passage, first off this is the first "sermon" that Matthew gives us explaining what exactly this kingdom of God is, and we must understand it is set in opposition to the expected military and spiritual kingdom the Jewish believers are expecting at this time. We also must remember that in this crowd we would expect to not only see pharisees, but a crowd of people that look up to the pharisees as the true moral, and devout Jews of their time.
Jesus started out telling us the upside down nature of the kingdom through the beatitudes, and then tells us how important it is to live this kingdom, in all its difference before the world. That the way we live will cause others to glorify God. And now he begins to touch on the issues of morality.
The Fulfillment of the Law
17"Do not think that I have come to abolish the Law or the Prophets; I have not come to abolish them but to fulfill them. 18I tell you the truth, until heaven and earth disappear, not the smallest letter, not the least stroke of a pen, will by any means disappear from the Law until everything is accomplished. 19Anyone who breaks one of the least of these commandments and teaches others to do the same will be called least in the kingdom of heaven, but whoever practices and teaches these commands will be called great in the kingdom of heaven. 20For I tell you that unless your righteousness surpasses that of the Pharisees and the teachers of the law, you will certainly not enter the kingdom of heaven.
Remembering that the Jewish culture of this time would think that the entire basis for morality is the keeping of the law, including the temple sacrifices, Jesus gives us a radical new vision of morality. He will go more into the specifics in the next verses, but for now we are hit with a few startling claims. Let me first give my impression of 17 and 18:
Jesus is saying that the law is not to pass away until it is completed, or fulfilled. But Jesus is the fulfilment of the law and the prophets. By His death and resurection all of the law is fulfilled, and finished. But these people are not listening post resurection, they are listening before that fulfilment. And they are therefore still under the law. Now there are those that would state that the law is still binding until the world passes away, and I will not argue this at this point, however I do believe Romans 7 explains that the law was indeed completed.
But regardless of your position on this point we wind up in a very difficult place now. For those that break the commands, and teach others to do the same will be called least "in the kingdom of heaven", but those that keep and teach them will be great in the kingdom. The point is, though they will be least they are still in the kingdom.
But then Jesus adds that unless your righteousness surpasses that of the pharisees and the scribes you won't even make it into the kingdom! Now we must understand that this crowd is made up of pharisees and those that believe the pharisees and scribes to be the best jews, the most righteous, the most moral, and they do not get into this kingdom. But those that do not keep the law, and teach others not to keep it, will be in, though they will be least. Isn't that a bit strange?
The point is that righteousness in the kingdom is no longer to be judged by adherance to the law, nor the result of temple sacrifices, but rather an issue of loyalty to the king, and to the law of love. Remember in this time these people thought that if they just keep the law well enough, and if they are devout enough, if they are Jews indeed and in deed, that God will overthrow the Romans and they will reclaim their right of rulership. Into this context Jesus says, no, the kingdom will not come by violence, it will not come in power, or political might, but it will come in being the example of people that truly are ruled by God, regardless of their circumstances. They are to enter this kingdom now, to live in this upside down kingdom of the weak are the strong, the poor are the rich, the suffering are the blessed. This is the kingdom, and righteousness is determined by your commitment to the king, not the law.
Even the most zealous keepers of the law the pharisees are not entering the kingdom of heaven until they lay down their worldly aspirations.