To do something solemnly is to do it in a grave and earnest manner. While you might wear black to both a funeral and an art opening, it’s appropriate to behave more solemnly at the funeral.
Solemnly carries a sense of seriousness and dignity. If you're a witness in court, you'll be asked, "Do you solemnly swear to tell the truth, the whole truth, and nothing but the truth?" This would not be the time to bust out your clown nose. There are other scenarios where it’s appropriate to behave solemnly, like at a religious ceremony or at the bedside of an ill relative, but try not to act that way at a kid's birthday party.