Praise be to Allaah.
It is not permissible to pray in this mosque that is adjoining the grave, especially since the grave is in the qiblah faced by the worshippers, and between them there is a wall with windows in it that overlook the grave. It is still not permissible even if it does not occur to them to venerate the grave. It was reported that it is forbidden to pray in graveyards. ‘Umar saw a man praying at a grave and forbade him to do that, saying, ‘Don’t pray at the grave.’(Narrated by al-Bayhaqi, 2/435; classified as mu’aalaq by al-Bukhaari in his Saheeh, 1/523; classified as mawsool by ‘Abd al-Razzaaq, 1/404, no. 1581).
On this basis, you have to move the mosque to another place, or enclose the grave with a separate fence that will form a barrier between it and the wall of the mosque. And Allaah knows best.