The Gemara in Masechet Shekalim (7) cites the ruling of Rabban Shimon Ben Gamliel (listen to audio clip for precise citation), "Monuments are not made for the righteous; their words are their memory." This means that it would be inappropriate to erect a monument on the grave of a Tzadik, because it gives the impression that a stone is required to perpetuate his memory, when in truth his Torah is what keeps his memory alive.
Of course, Jewish practice throughout the ages has been to erect tombstones on the graves of great Tzadikim. How may we reconcile this widespread practice with Rabban Shimon Ben Gamliel's ruling?
A partial answer emerges from a comment of the Yabetz (Rabbi Yaakov Emden, Germany, 1697-1776), who noted that the patriarch Yaakov indeed erected a tombstone over the grave of his righteous wife, Rachel (Bereishit 35:20), seemingly in direct opposition to Rabban Shimon's comment. The Yabetz explains that since women are exempt from the formal obligation of Torah study, we cannot apply to them the reason given for not erecting tombstones – "their words are their memory." Since women generally are not teachers of Torah, it is indeed appropriate to erect monuments to perpetuate their memory.
The Yabetz's analysis suffices to explain the practice to erect tombstones over the graves of righteous women; it does not, however, provide a basis for allowing tombstones at the gravesites of righteous men.
The Mishnat Yosef suggests that although ideally tombstones should not be necessary for the perpetuation of a Tzadik's memory, the Sages that lived after the time of the Talmud saw a need for tombstones to help ensure that the Torah will never be forgotten. They feared that with the natural decline of the generations and the difficult tribulations of exile, the Jewish people may forget the Torah. Erecting visible tombstones on the graves of Tzadikim helps preserve their memory and in this way ensures the continuity of the chain of tradition passed from one generation to the next through the teachings of the scholars.
The Mahrash Silio advances a much different interpretation of the Gemara's comment, whereby it does not forbid erecting tombstones to memorialize Tzadikim. According to his reading, the Gemara simply meant that a monument is not necessary for perpetuating the memory of a Tzadik, since his memory lives on through his Torah teachings. There is, however, an additional reason for erecting tombstones, namely, to serve as a marker of where the Tzadik is buried. It is important to visibly mark the gravesite so that Kohanim do not approach the grave, and also for those who wish to pray at the gravesite. Therefore, it is certainly permissible to erect a tombstone over a Tzadik's grave; the Gemara simply meant that the other reason for erecting a tombstone – to memorialize the deceased – does not apply to Tzadikim, since their memory is perpetuated through their Torah.
Likewise, Rabbi Moshe Feinstein, in his "Iggerot Moshe" (Yoreh Dei'a, 4:57) notes that there are Kabbalistic reasons for erecting a tombstone at the gravesite of a Tzadik, as discussed at length in the writings of the Arizal and Rabbi Chayim Vital, and in the work "Ma'avar Yabok." Therefore, even if a tombstone is not necessary to memorialize a Tzadik, it serves other purposes, as well, and is therefore permissible.
In conclusion, then, the widespread practice of erecting tombstones at the gravesites of righteous men and women is perfectly valid, and it should not be perceived as an insult or affront to the honor of the Tzadik.