The Rabbis taught: In cemeteries – one may not behave with levity. And one may not (so it is in the Rif) graze an animal in them, and one may not lead a water channel through them, and one may not gather grasses in them. And if one gathered – he must burn them in their place (Megillah 29a). And it appears to me that this is the explanation: One may not behave with levity – meaning to eat and drink there. Just as we learned there previously regarding synagogues, that one may not behave with levity – one may not eat in them, and one may not drink in them, and one may not adorn oneself in them, and one may not stroll in them, etc. And in the Mishnah there it added further things: that one may not twist ropes inside it, and one may not spread nets inside it, and one may not spread fruit on its roof, and one may not make it a shortcut, see there. And all these are included in levity. Therefore, the baraita here was brief, and only added that one may not graze an animal there, and a water channel, and gathering grasses, for all these are not relevant to a synagogue and therefore it enumerated them here regarding a cemetery. (And regarding a synagogue it mentioned eulogy under levity, and this is not relevant to a cemetery, for its primary purpose is for eulogy.)
תנו רבנן: בית הקברות – אין נוהגין בהן קלות ראש. ואין (כן הוא ברי"ף) מרעין בהן בהמה, ואין מוליכין בהם אמת המים, ואין מלקטין בהן עשבים. ואם ליקט – שורפן במקומם (מגילה כט א). ויראה לי דהכי פירושו: אין נוהגין בהן קלות ראש – היינו לאכול ולשתות שם. כמו ששנינו שם מקודם לעניין בתי הכנסת, דאין נוהגין בהן קלות ראש – אין אוכלין בהן, ואין שותין בהן, ואין מתקשטין בהם, ואין מטיילין בהם וכו' ובמשנה שם השיב עוד דברים: דאין מפשיטין בתוכו חבלים, ואין פורשין לתוכו מצודות, ואין שוטחין על גגו פירות, ואין עושין אותו קפנדריא, עיין שם. וכל הני בכלל קלות ראש. ולכן קיצרה כאן הברייתא, ורק הוסיפה דאין מרעין שם בהמה, ואמת המים, וליקוט עשבים, דכל אלו לא שייך בבית הכנסת ולכן חשבן כאן בבית הקברות. (ובבית הכנסת השיב הספד בקלות ראש, וזה לא שייך בבית הקברות דעיקרו להספד.)