In a case where both the mother and father of a child have either died or are in jail then I think if the grandparents are willing to take the child in then they should be awarded custody of that child, I think it would benefit a child greatly to go to a grandparent then a foster care system.
There are many sad cases where the custody of children can not be with the actual biological parents. Often, the options are foster care and social services or possibly passing custody to grandparents. Even in the event where personal or family issues make the actual parents incapable of having custody, that does not mean that such issues always are present with grandparents too. Often, they might be wiser and more financially sound and able to provide for children.
Child custody is an extremely touchy issue that warrants consideration. When a child loses a parent or a parent is not fit to care for a child, the next best option is often a grandparent. At least this way the child stays in the family with a similar support structure to before the loss.
I believe that grandparents should have the ability to be awarded child custody. If there is a case where a child needs to go to the best home possible, then the grandparents should have the ability to be awarded being their guardians. If they are the best and most qaulified for the child's well being, it only makes sense.
I think in the past, the age of grandparents used to be an issue, but nowadays people are living to much older ages, and are staying fit and healthy for much longer. I think for many children, it is quite possible for their grandparents to stay healthy for as long as it takes to raise them. There are many situations where grandparents could be the best option for custody.