When a man vows a vow to Hashem, or swears an oath to bind his soul with a bond, he shall not break his word; he shall do according to all that proceeds out of his mouth.
The Ohr Hachaim asks why the Torah uses a double expression; vows a vow or swears an oath? Why does the Torah not merely say אִישׁ כִי יִדֹּר לַה' אוֹ הִשָּׁבַע - a man that vows to Hashem, or swears to bind his soul?
Additionally, why does the Torah give two commands at once? First, he shall not break his word; then he shall do according to all that proceeds out of his mouth. What is the purpose of the two commands being one?
The Ohr Hachaim explains that a person can take two types of oaths or vows. A person can take on a vow regarding matters that pertain to his soul. This is either when a person decides to learn something, teach something, donate something to others, or generally do something for someone else. He could also decide to forbid himself from doing something, for example, living in the neighborhood of a loose woman or spending time with people of frivolous attitudes. A person can also adopt vows regarding his personal decisions, which have no relevance to his spiritual issues. For example, he can accept on himself to eat a certain food, live in a certain place, or act a certain way. Alternatively, he can vow not to eat certain foods or wear certain clothing.
The Torah tells us precisely what we should do. “If a person shall vow a vow”, corresponding to a person who vows to go somewhere or do something that he is not commanded to do, he must regard it as a vow. Then there are other vows that are vows to Hashem, to do something for Hashem, i.e. adding to his service of Hashem. That is the meaning of the double expression כִי יִדֹּר נֶדֶר – who will vow a vow. Both types of vows are included.
The same is true with the oath, which refers to actions a person forbids himself from taking action, instead of the opposite. This includes someone who forbids himself from doing something that has no connection to any prohibition, as well as someone who takes an oath to prevent himself from transgressing a prohibition. Both secular and religious oaths are included in this category.
This is why the word לַה' is placed between the vows and the oaths, to show that both vows and oaths can be for Hashem, and the double expression tells us that both vows and oaths have other options, i.e. regarding matters that don’t pertain to mitzvos. All of these utterances are binding on a person, but in different ways.
לֹּא יַחֵל דְּבָּׁרוֹ - he shall not break his word, and Chazal deduce that others may break his word. This is the source of the idea of a Beis Din, or an individual expert in the laws of Nedarim, canceling a person’s vow or oath. This only applies to vows and oaths that are undertaken for non-religious matters. If a person vows to eat a certain food or takes an oath not to eat it, he may go to Beis Din and have it canceled.
כְּכ ל הַיֹּצֵא מִפִיו יַעֲשֶה - he shall do according to all that proceeds out of his mouth. This is unconditional and refers to those vows and oaths that are regarding mitzvos and aveiros. When a person accepts on himself to perform a mitzvah or to refrain from an aveira, he cannot have this annulled by a Beis Din, he shall do according to all that proceeds out of his mouth, with no exceptions or caveats.
