"You are children to Hashem, your G-d, you shall not cut yourselves for a dead person. For you are a holy people to Hashem, your G-d, and Hashem has chosen you for Himself to be a treasured people" (14:1,2)
The specific prohibition against cutting oneself in grief over a death is unique to Am Yisroel. Ibn Ezra notes that gentiles, until his day, mutilated their bodies in mourning. Their practice was entirely appropriate (Kli Yakar, Ohr Hachaim), because they are not described as Hashem's children (Avos 3:18), nor are they his chosen, treasured people (14:2).
The Torah's attitude towards the loss of a loved one, as reflected by the prohibition against cutting oneself, touches on fundamentals of belief. Our personal status as children, and our national chosenness as a treasured people, are explicated by the classical commentators.
Ibn Ezra notes that a father loves his children and does only his best for them. Hashem loves us more than a father, and all that He does is good. If we don't understand, we are like small children who don't understand their father's actions, but rely upon him. So, too, should we respond to personal loss. Indeed, the blessing recited upon such loss refers to Hashem as the true Judge.
Sforno adds that grief over the loss of a relative is mitigated when a more honored relative remains. As children of Hashem, the existence of our Eternal Father gives us comfort. In this vein we recite in the upcoming month of Elul, "though my father and mother have forsaken me, Hashem will gather me in" (Tehillim 27:10). Ohr Hachaim goes further and says that Hashem is likened to a father who sends his son on a business trip. When he calls his son back home, it is to the son's benefit. If our relative, a child of Hashem, is recalled to his Father, we ought not grieve excessively.
This theme emerges, according to Sforno, from the phrase "you are a holy people". As such, "all Yisroel has a share in the world to come" (Sanhedrin 90a), whose pleasures exceed those of this world. As such, we should not feel terrible pain for the deceased, as he is in a better place. Kli Yakar derives this idea from the expression "a treasured people". Just as treasures are placed in a storehouse, so Hashem preserves the souls of righteous. Why should one feel pain for a soul that shines in Heaven?
The Ramban quotes both terms, and cites the prohibition to mourn excessively (Moed Kattan 27b.) The Torah does not prohibit crying, since human nature arouses crying when loved ones separate and relocate even when they are alive. Some of us have witnessed the uncontrollable sobbing of a parent or grandparent bidding farewell to a descendant traveling to a distant land. Although the child is in a safe, and perhaps better, place, the expectation that he will not see his child again evokes a powerful emotional response. This emotion abates in a matter of days, as should crying for the loss of a relative (ibid).
The Torah's prohibition against prolonged or excessive grief should not be misinterpreted as fostering insensitivity. Rather, it reflects the fundamentals of our belief and the commandment to act upon them in all circumstances.