Most of the mentions of mice in the HP books have been in relation to feeding owls. Although Hagrid doesn't seem to have an owl of his own, he does have friendly relationships with a lot of other predatory animals. It seems probable that the mice are intended as food for something - exactly what, we have no way of telling (perhaps Fluffy, as someone mentioned in a comment.)
If you want to look at it logically, let's consider the possible reasons somebody might want to keep live mice.
- As pets.
Nah, that's not very Hagrid, is it? Mice aren't big or dangerous enough to keep his attention for very long. If it can't kill, eat, maim, or injure you pretty casually, it's probably not one of Hagrid's pets.
- As experimental objects.
Animal experimentation is a sad reality, and the majority of vertebrates experimented on are mice. It's no less of a reality in the Potterverse, where eleven-year-old students are expected to transform mice into snuffboxes for their first-year Transfiguration exam. (Seriously, where's the Ministry when you really need them? Or Hermione with her Society for the Protection of Animal Elf Welfare?)
Again though, this doesn't sound much like Hagrid. He's never been great at performing magic, and experimenting on mice isn't one of the necessities of life like lighting fires - not to mention that his love for animals would probably prevent him from hurting even a mouse, unless it was necessary or in a good cause. Which brings us to ...
- As food.
From Hagrid's point of view, tiny creatures like mice could easily be sacrificed for the sake of nurturing a terribly dangerous cute monster. From owls and cats to dragons and Blast-Ended Skrewts, every creature needs to eat, and those that Hagrid likes need to eat meat. We don't know what specific beast Hagrid might have been tending at that time, but probably something that would see a mouse as a tasty little snack.
It's even possible that Hagrid might have been planning to eat them himself. As this questionthis question shows, he's not averse to eating stoats or some unknown meaty animal with talons. And dormice have actually been eaten even by normal people for thousands of years. I haven't been able to come up with a convincing argument against this one, but my gut feeling says no, he was going to feed them to one of his 'pets'.
(Thanks to @WadCheber for professional advice on the culinary properties of dormice.)