This scene is of course one of Teddy's hallucinations, but I would try to answer your questions in order.
What were the rats eating?
They weren't shown to "eat anything" here. I do have a part of the original script written by Laeta Kalogridis where she mentions quite a bit about the rats but she doesn't say anything about them "eating anything", as this was of course a hallucination which leads to an even more important "Cave Scene"
Source
" A RAT dropping onto a wet boulder, tiny paws SCRATCHING wetly. O.S.
MORE SCRABBLING NOISES-- Teddy turns, looks past the rat-- Lo see
HUNDREDS OF RATS EMERGING from the deep CREVICES of the cliff face,
nose TWITCHING, eyes GLITTERING in the full moonlight
TEDDY takes a step BACKWARDS, foot SINKING in the wet sand.
THE RAT plop off from the rocks on the SAND, SQUEAKING, their eyes
like DAGGERS glinting at him."
And to answer your second question: What is the significance of this scene?
Teddy himself says “survival instincts become defense mechanisms”, him
finding a cave to survive the storm. Before this, he sees Chuck’s
corpse on the rocks but it is seemingly washed away by water, wiping
away another made up image. He then sees hundreds of rats pouring out
of a hole, signifying erupting desire out of paranoia and initiating
the Rachel hallucination. Source
So, finding the cave, was in itself a manifestation of Teddy's own mind using "survival instincts" and the rats were most possibly, remnants of his past life during his days at the German Camp, where he may or may not have been a part of and witnessed mass shooting and the pile of the corpses laid alongside the path.