Get your taxes done using TurboTax

You can claim them as dependents if they lived in your home more than half the nights of the year.   It is not necessary for you to gain legal custody from the court since you are a grandparent, the child's residency is enough.  However, if you don't have income earned from working, you will only be eligible for the $500 credit for "other dependent."