My grandmother died a couple of years ago, and I brought my son with me to the funeral (4 years old at the time).
I just tried to be honest with him. We'd visited her many times, and he had already seen her suffering from dementia. She recognized him, but she didn't talk any more. Him and I had talks about how much she loved him, but that she was very old and her body didn't work the same way it did when she was younger. But it didn't change how she felt about him.
At the service, I let him choose whether or not he wanted to look at her body (he did). I told him that it would look like she was sleeping, but that she wasn't. That all we know for sure is that her body doesn't work any more. Some people have different beliefs as to what happens when you die, but no one really knows for sure.
After the service we looked at pictures of her when she was younger, and talked about her life. And that even though he knew her near the end of her life, she had done so many things before they had met. By this time, he was getting antsy, and appreciated the chance to run around with the other kids that were at the reception.
I think you just need to be as sincere as possible, without sugar coating too much. At the same time, kids are still learning, so you might need to simplify a few things without being dishonest.