First, my condolences on the passing of your grandchild.
Second, as it pertains to your question, sadly, you cannot baptize someone who has died. The Church forbids this, in fact, assuming you are certain that the person has died. For instance, if there is any doubt as to whether or not someone is still alive, the person should receive the Anointing of the Sick. The same logic would apply for a baptism. So, if your son is certain that his baby has died, he should NOT baptize her. And, in fact, he CANNOT baptize her. Certainly if he is certain she is alive, he SHOULD baptize her. If there is any question (honestly), he should baptize her. But, if the baby’s heart has stopped beating, it sounds, tragically, like the child has died. Again, my condolences.
I realize this does not seem like the most “pastoral” approach to the situation. As a priest, I’ve had a few cases where this has happened, and it is hard explaining to parents why I cannot baptize their babies. But, the sacraments are not there to help us feel good about ourselves. And, as someone said, we don’t want to tend towards superstition. Remember, the sacraments are not magic. We simply must trust the child to the mercy of God, who is Mercy Himself.