All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
The jurists agreed that the fostering of the children when the spouses separate by divorce, is for the mother as long as she does not remarry. However, they differed about the order of those who have the right of fostering after the mother, but in general the women come in priority over the men as they are more affectionate (towards children).
The view of the Hanafi School of jurisprudence about fostering is as follows: first the mother, then the grandmother from the mother’s side, then the grandmother from the father’s side, then the sisters, but the full-sisters (from the same father and mother) come in priority, then the sister from the mother’s side only, then the sister from the father’s side only, then the maternal aunts, and then the paternal aunts. If the child has no woman (female relative) from his family who deserves the fostering, and the men (male relatives) differ about who would foster the child, then the closest paternal relative to him/her comes in priority for the fostering, in which case the father comes in priority, then the grandfather, and then the brother. For more benefit, refer to Fatwa 84618.
Based on the above, you have the right in fostering your grandsons if there is no other relative who deserves more the fostering than yourself.
Furthermore, you are not obliged to spend on the wife of your son, but if she is poor and you spend on her, then you get the reward from Allaah for doing so. As regards your grandsons, if they do not have money [are poor] then you are obliged to spend on them.
Finally, it should be noted that the grandsons and granddaughters have no share in the inheritance if there is a male child from the deceased, but if there is no male child from the deceased, then they inherit from the remaining of the inheritance after all the other heirs take their legal fixed shares, because they are Asabah (i.e. the closet paternal relatives who are entitled to inherit the residue after those who have fixed share in the inheritance) for more benefit, please refer to Fatwa 90126.
Allaah Knows best.