"I'm so sorry for your loss, I can't imagine what you're going through" is a good place to start. I found the acknowledgement that someone else didn't know comforting (unless you've been through the exact same thing, people, though trying to help, have said they understand, when they've had early miscarriages, as it feels a bit dismissive... but that's just me.
You say miscarriage - but that they've named the baby, so I'm guessing that it was a late miscarriage, and the mother had to deliver it? Therefore it is their baby, they will have memories of their little one's features, and their grief profound.
I didn't have a miscarriage, I had a 37 week stillborn daughter, but would have been so happy to have relatives like you, who are willing to stand up and show that the baby is a part of the family.
Another thing - have they had a funeral for the baby. If so, maybe take something for the grave (if he/she was buried). Always refer to the baby by name. Send a card, and put the baby's name in it, so they know that you consider the baby a family member, not just a miscarriage.
If they took photos of the baby (and I don't know from your post whether it would have been likely), then a nice photo frame could be an idea, or give them a plant, that they can put in their garden, to remind them of their child. You can ask them what you can do to help, the thought I'm sure would be appreciated.
Let them know that you're there for them, and listen if they want to talk (but don't press if they don't). It doesn't matter if you're close or not, I've found some people who I thought were friends, who I thought I could count on, just disappeared, or expect me to just 'get over it', and they're not people I'd trust ever again.