~Courteous people are empathetic-able to relate emotionally to the feelings of others. They listen closely to what people say. They observe what is going on around them and register what they see. A self centered person might say ,"I know exactly how you feel" to someone in a traumatic situation and then immediately start describing his own experiences. An empathetic person is more likely to say something like, "I can't know how you feel right now, but I can understand your grief [or anger or sadness]. And if you want to talk about it I'm here to listen." -Emily Post Etiquette 17th Edition, Peggy Post~
When a pregnancy loss occurs the stories of others losses often come out of the wood work. While there is nothing wrong with sharing your personal story of grief and recovery with a mother whose world has just fallen apart there are some ways to go about it that are better than others.
In my own experience I had many people who approached me and told me how sorry they were to hear of my loss and that they knew how I felt, they had loss a pregnancy also. While I smiled and listened to their condolences I really wanted to tell them they had know way of knowing how I felt. They could understand part of they sadness, the anger, the longing in my heart but their experiences were not the same as mine. Except online I did not encounter a woman who had lost a child due to my condition (a cervix that is too week to hold a baby to term). Most of the women that told me their stories had miscarried very early and after having had one or two children. I do not discount their grief, however, that is a very different experience from your first and second children being carried almost to a point that they could have survived, and holding them in your arms.
The best condolence I received was after my first loss when a neighbor of mine who had experience seven early miscarriages had stopped at my house for something. During the course of our conversation she told me that she didn't know how I did it (dealt with the grief of losing a baby at nearly five months along), all the while I could not imagine being her losing one baby after another and having no idea why my body would not hold a pregnancy for more than a few weeks.
God gives us special graces to deal with our individual circumstances and will never allow us to go through more than we can handle at one time, even if it seems we are 10 inches over our head at the time. That is a grace for our life and our trial though and does not mean we can know what the person next to us is feeling, experiences such as these even effect spouses in profoundly different ways. If you find yourself giving condolences to someone who has just lost a pregnancy a shoulder to cry on is the best first offer, let them talk about their grief, and if they are open to it you can use your experience to help them to work through their grief.
My own response to pregnancy loss veries at this time. I will often gauge it on how well I know the person. Most people who know me know my story so I do not even have to tell them my experience. I do offer condolences, a shoulder to cry on (or a in-box to vent to). I also offer ideas to memorialize the pregnancy and/or books to read that can be helpful. From there I allow the other person to take the lead.