If I had to guess I'd say it's a source of bioluminescent light, a lure akin to anglerfish, or a way to attract a mate not dissimilar to bird plumage (though present on males and females alike). Flashy bits tend to be for attracting mates or warning other animals of danger, and well, moogles aren't all that threatening on average...

It's never been explained in-universe and honestly was probably just included in their design as a way to make them cuter... and has been present in every iteration of moogle in the franchise, so it would have to be on XIV's regardless of whether there's a lore explanation for them or not.

Decided to impulse roll on Okita's banner and my Devil's Luck kicked in, getting me Ozymandias!

Kept rolling with the leftovers and got a gold Saber... but it was just a third Mordred. :'(