The words that comfort a grieving person are short and plain: "I'm so sorry." "I'm here." "I loved them too." "Tell me about her." The words that wound are the ones people reach for to fill the silence, the ones that explain the death, minimize it, or hand the griever a lesson. You do not need to be wise. You need to be present and honest.
This pairs with how to help someone who is grieving, which covers what to do. This page is what to say.