Megillah, Chapter 3, Mishnah 3. The Mishnah opens with the words "Ve'od amar Rabbi Yehuda" - continuing his statement in the previous Mishnah, where he was lenient about selling a synagogue for use as a mere courtyard, in which case the buyer may do with it as he wishes. Here Rabbi Yehuda adds a further law: when a synagogue lies in ruins, its sanctity remains, and therefore certain activities are forbidden in it.
The things forbidden in a synagogue even after it has fallen into ruin:
"Ein maspidin b'socho" - one does not deliver a eulogy inside it. A synagogue is a large, comfortable building that holds many people, and a person might well want to hold a eulogy there. This prohibition applies to the eulogy of a private individual; but the eulogy of one of the leaders of the city is permitted, even while the synagogue is still standing and not in ruins.
"V'ein mafshilin b'socho chevel" - one does not twist ropes in it. This work requires a large open space, and so a person might be tempted to use the building for it.
"V'ein porsin b'socho metzudos" - one does not set traps for animals in it. This does not refer to pests, but to trapping for the sake of the fur or for any other purpose.
"V'ein shotchin al gago peiros" - one does not spread out fruit on the roof of the synagogue in order to dry it.
"V'ein osin oso kappandaria" - one does not use it as a shortcut.
The source for the law that the sanctity remains even after the destruction:
This principle is derived from the verse in Vayikra: "Vahashimosi ani es mikdesheichem" - the Torah warns that the holy places will be laid waste, and nevertheless it continues to call them "your sanctuaries." From here we learn that "their sanctity remains even when they are desolate": even after they have been destroyed they are still considered holy, and therefore one may not do in them the things listed in our Mishnah.
"Alu bo asavim lo yislosh":
If grasses have sprouted on the walls of the synagogue, as one can see on the Kosel, they should not be pulled out - "mipnei agmas nefesh". The intention is to create a measure of sorrow, that emotional pain felt by those who see the neglected state of the place, and this sorrow will stir hearts and move people to rebuild it.
The Gemara explains that the prohibition is to pull out the grasses in order to feed them to one's animal; but if he pulls them out and leaves them where they are, there is still sorrow in seeing them, and therefore it is permitted.
In summary: in this Mishnah we learned that the sanctity of a synagogue does not lapse when it is destroyed, and therefore one does not deliver the eulogy of a private individual in it, does not twist ropes in it, does not set traps in it, does not spread fruit on its roof and does not use it as a shortcut - all on the strength of the verse "Vahashimosi es mikdesheichem," that their sanctity remains even when they are desolate. We also learned the law of the grasses that grow on its walls, that they are not pulled out because of the sorrow they arouse - and it is because of this Mishnah that the vegetation growing out of the Kosel remains there to this day.