God did not withhold grace so that the Pharisees and scribes could not understand; they put up barriers to God’s grace and thus were unable to understand.
God’s grace is offered to everyone, including the Pharisees and scribes. But Jesus knows that their disposition is such that they will not respond to God’s grace. (They don’t want to give up their sins; they don’t want a kingdom anywhere but here; they want to be in positions of power, not positions of service as Christ’s message commands.) Therefore, they will not be able to grasp the deeper meaning that the parables help the willing mind to understand.
So Jesus wants to teach those willing to hear what he has to say without revealing information to those who, through their unwillingness to understand it properly, might use the information against him and others who follow him. Christ says, “Do not give dogs what is holy; and do not throw your pearls before swine, lest they trample them under foot and turn to attack you” (Mt 7:6).