You don't necessarily need to hew to tradition, but make sure you've thought it through before you respond to news of a loss so that your offerings, verbal and otherwise, are gracious and of service to another who is suffering. It's OK to even say, "I'm at a loss for words," and give a hug or squeeze a hand.
My story may have ended there, had it not been for a head on automobile collision I would have some 20 years later. I passed out on impact and was immediately enveloped by a warm bright light. As I moved towards the light I had the most euphoric feeling of love and inner peace that I had ever experienced.