We're all familiar with the scene at the beginning of ROTJ where Luke beats the mighty beast that looks like something out of space Jurassic park. It has a face that one might say only a mother could love.
Everything about this creature emphasizes how monstrous it is. There's obviously the design, but there's also the fact that it is Jabba's method of destroying those who displease him. The horror is mild, but there are undertones of monster movie-esque themes in the scene. Luke waiting for the rancor to emerge from the shadows, etc etc. For all that, it's typical action movie stuff, and it ends in a moment that the audience might find a little humorous. After Luke defeats the rancor in a Jedi hero moment, the movie turns to the rancor keeper - who cries over the monster's death.
It's a ludicrous contrast, and although perhaps a bit touching, more funny than anything else. Monsters are meant to be beaten - what else would you do with one? Even this monster had someone who loved him is the underlying message, but there is a little bit of "pet owner of savage dog" type thing going on. I would say it's primarily meant to be humorous in the moment. After all, who would mourn the death of a brutal monster?
Fast forward to the last part of the movie, though, and all of a sudden...
Much like the rancor keeper, Luke is alone in his grief. A major theme of ROTJ is how solitary his journey is. He's set apart from the others. Although I would argue the potentially scorching hot take that Leia would also feel grief over Vader (just an entirely different grief), Luke stands alone.
If we turn back to the rancor keeper and his grief for an attack monster now (notably, a monster kept at the beck and call of a corrupt ruler), it suddenly has a new light, and the question implicit in the moment - monsters are meant to be beaten; after all, what else would you do with one? - suddenly has a new answer.