The Pharisees and some of the teachers of the law who had come from Jerusalem gathered round Jesus and saw some of his disciples eating food with hands that were defiled, that is, unwashed. (The Pharisees and all the Jews do not eat unless they give their hands a ceremonial washing, holding to the tradition of the elders. When they come from the market-place they do not eat unless they wash. And they observe many other traditions, such as the washing of cups, pitchers and kettles.)
So the Pharisees and teachers of the law asked Jesus, ‘Why don’t your disciples live according to the tradition of the elders instead of eating their food with defiled hands?’
He replied, ‘Isaiah was right when he prophesied about you hypocrites; as it is written: ‘“These people honour me with their lips, but their hearts are far from me. They worship me in vain; their teachings are merely human rules.”
You have let go of the commands of God and are holding on to human traditions.’
And he continued, ‘You have a fine way of setting aside the commands of God in order to observe your own traditions! For Moses said, “Honor your father and mother,” and, “Anyone who curses their father or mother is to be put to death.” But you say that if anyone declares that what might have been used to help their father or mother is Corban (that is, devoted to God) – then you no longer let them do anything for their father or mother. Thus you nullify the word of God by your tradition that you have handed down. And you do many things like that.’
Again Jesus called the crowd to him and said, ‘Listen to me, everyone, and understand this. Nothing outside a person can defile them by going into them. Rather, it is what comes out of a person that defiles them.’
After he had left the crowd and entered the house, his disciples asked him about this parable. ‘Are you so dull?’ he asked. ‘Don’t you see that nothing that enters a person from the outside can defile them? For it doesn’t go into their heart but into their stomach, and then out of the body.’ (In saying this, Jesus declared all foods clean.)
He went on: ‘What comes out of a person is what defiles them. For it is from within, out of a person’s heart, that evil thoughts come – sexual immorality, theft, murder, adultery, greed, malice, deceit, lewdness, envy, slander, arrogance and folly. All these evils come from inside and defile a person.’ - Mark 7:1-23
There are a lot of ways to become unclean in the Torah. It was important that the people of God retain a uniqueness--a holiness--as the people of Yahweh in the face of the other nations. This included the way they dressed and the foods they ate. This was reinforced by the stories that came later in the histories and prophets. For example, Daniel rejected the diet offered to all the foreign-born servants in the palace of the king of Babylon, preferring a vegetable diet over the "rich diet" of the king.
In these verses, Jesus as rabbi gives one of his keys to interpreting the Torah: focusing on the core laws (the 2 and the 10 commandments) that deal with other people and focusing on heart intent. He says that the core laws focus on the "why" of what we do over the "what" of what we do. He then says that the food laws don't have anything to do with the core laws. He then elaborates again in these verses, saying that laws about being "corban" (dedicated to God) don't have anything to do with (and certainly don't invalidate!) the core laws.
Why does Jesus say that the other laws are not necessary? This is a big topic, but short answer: because God intended that the laws help his people, not hurt them. Most of the dietary and lifestyle laws were not related to "health" (some people have struggled to find some great benefits, but none are convincing) but more about maintaining Israel's distinctiveness among the nations as Yahweh's special people. That is, they were about honoring the God whose people they were. But what if their obedience became more about their feeling of uniqueness and less about Yahweh? What if God said, ultimately, "your hearts are far from me."? Then they were doing the right thing but for the wrong reasons.
One of the wrong reasons is: using laws so you can feel "right" and justified in feeling they were "wrong" We can see this when the Pharisees questioned Jesus about his disciple's behavior. A whole host of rules and regulations had been built around the food cleanliness laws to make sure that there was no chance of ingesting something that might possibly (in the remotest sense) become unclean. This web of regulations governed every meal and every journey. But saying "yes" to tracking these "might not be bad but still good to avoid" ticky-tack rules while allowing the bulldozer of parental neglect (part of one of the core laws) pass through was pretty infuriating.
Jesus called it a heart issue. In a related passage in Matthew 12, Jesus says: "If you had known what these words mean, ‘I desire mercy, not sacrifice,’ you would not have condemned the innocent..” (Matthew 12:7) Is God really concerned about the food you eat? Or about remembering that he is holy and unique and the center of my life?
Obeying God's law means giving proper respect to him and the people whom he made. I want to obey God for the right reasons.