Give thanks for all that Heavenly Father has blessed you (everyone there) with, including the opportunity to be together at that moment. Make a mental list if you have to. There is never a time where we give enough thanks for what we have.
Ask for the spirit to guide you as your pray. Ask for an added measure of the spirit to be with you and everyone there during this somber occasion, that those there will feel the love of G-d in their hearts.
Pray for your grandmother, let the spirit guide you in what the Lord would have you say. Pray for those who were closest to your grandmother, ask humbly that they may be comforted and have the spirit testify to those whose hearts are hurting most that your grandmother has passed through the veil to her rest, and there is no need to grieve for someone who is at peace.
Do NOT quote that word for word, obviously. But those are just thoughts that might occur to me if I were in a setting like that.
Never rehearse a prayer except for the sacrament prayers. I personally outline the structure of the prayer and let the spirit fill in the important stuff. For instance ....
1. Give thanks
2. Ask for the spirit to be there
3. Ask for special blessings for those in need
I never remember giving an opening or closing prayer. The first blessing I gave to my wife after we were married was over 10 minutes and I didn't remember one moment of it. When she transcribed it and I read it I couldn't believe that blessing came from me. The spirit will know what should be said, and if you go in there with something too specific or rehearsed then you're limiting the spirit. IMHO anyway.
If your prayer is only a few lines, then it's only a few lines. If it turns into novel, then it turns into a novel. You will never be out of place with the spirit directing you.
Sorry if this came off as kind of speechy. I get that way sometimes. Just trying to pass along what i've learned from experience. You will do great. Say a prayer to and for yourself privately before you go up to offer the opening prayer. Ask the spirit for help if you're nervous, try to be as in tune with the spirit as you can.
Hope some of that helps.