Sheikh `Umar al-Muqbil, professor at al-Imâm University
Regarding the salutation that one might give at the graveyard, it is cited in Sahîh Muslim from the hadîth narrated by Abu Hurayrah that the Prophet (peace be upon him) visited the graveyard and said:
Al-Salâm `alaikum dâr qawmin mu’minîn wa inna in shâ’a Allah bikum lâhikûn
(Peace be upon you, believing denizens of the grave. Allah willing, we sahll one day be joining you.)
Also,in Sahîh Muslim reported by `Aishah, the Prophet (peace be upon him) taught Muslims to say when they visit the cemetery :
Al-Salâm `Alâ ahl al-Diyâr min al-mu’minîn wa al-muslimîn wa yarham Allah al-mustaqdimîn minnâ wa al-mustakhirîn wa innâ inshâ’ Allah bikum lalahikûn.
(Peace be upon you, believing and Muslim denizens of the grave. May Allah have mercy one those of us who have already passed beyond and those who are still to do so. Allah willing, we shall one day be joining you.)
One more text was mentioned in the hadîth related by Buraydah, who said:
The Prophet (peace be upon him) used to teach them when they visit graveyards what to say. They would say “Al-Salâm `ala ahl al-Diyar” and in another context “Al-Salâm `alaykum ahl al-Diyar min al-mu’minîn wal-muslimîn wa innâ inshâ’ Allah la lâhikûn, As’al Allah lanâ walakum al-`âfiyah”.
(The additional phrase here is: "We ask Allah for what is good, for you and for ourselves."
Any of these forms of supplication may be used. It is preferable to use them all on different occasions.
I do not know another special salutation for the Prophets and martyrs. They can be treated as others.
And Allah knows best.
Source: Islam Today