When visiting a grave, it is most appropriate to say a short prayer at the cemetery, asking God to grant eternal rest to your loved ones.
The most common prayer at a cemetery is the "Eternal Rest" prayer.
You can also pray the prayer of St. Gertrude for the souls in purgatory.
A simple Hail Mary or even a Rosary could be prayed at a cemetery as well.
There is no "right" prayer to pray at a cemetery. The key is to pray for the repose of souls, and to ask God to have mercy on them.