It was easy for the Pharisee to fall into the temptation of thinking he was better because he really was a good man. He fasted twice a week whereas Jewish law asked to fast only once a year. He was a really good man but he lacked compassion for others because he had not experienced problems himself. Nothing helps to mature us like suffering does. He had never fallen in life so he was proud.
Pride comes before a fall.
And often a fall is what it takes for someone to lose their pride and realize that they are human the same as everybody else. When it comes to sin and grace we are all on the same playing field, none of us deserves or earns heaven, it is a gift from God to us won by Jesus suffering, death and resurrection. There is some of the pride of the Pharisee and some of the humility of the tax-collector in each of us. Each of us, to a greater or lesser degree is called by Jesus in our Gospel to make that journey from pride to humility. There are very few people who have room for two gods so if you re God, God in heaven loses out.