Custody is complicated and it is indeed very important to try to find a lawyer to help you with your case. And the regulations vary from state to state as well. If your grandchild is in danger, you can ask for the temporary emergency custody, which most states provide.
The most binding way to do this is to file through the juvenile or family court in your state and or county. The only other way that I am aware of is to have a written or typed contract of temporary care between yourself and the party you are sharing care with.
There is a D.F.C or something like it, Dept. Of Family Services, Dept. Of family and Children. Find out what the name of your State Agency that deals with these issues. Call and ask them, anonymously if you do not want the Agency to take the child. Ask what the procedures are to gain custody. My Step Father was awarded temporarary Custody, when I was in the hospital.
I'm not sure but I think you can, if you are not the parent, go to court and tell a judge why you need temp. Custody and they will grant it for you if you actually have a reasonable and just cause.
This question includes your son or daughter, whichever one this grandchild is being the product of. You are saying, you think that your offspring is neglecting their offspring? Or is your grandchild in a foster home already, or other form of alternative care? If you are at odds with your own child, this would have to be included in your issue. Because if you are not yet estranged from your child, this type of action will cause estrangement. If this grandchild is in an alternative care situation, then it would be appropriate to arrange a visitation with the child and see what treatment is being received. If you are having a difficulty with your child who is the parent of the grandchild, you probably need to talk to your child. Temporary custody could lead to consequences against the child of yours that you may not desire. Would you like to clarify your question?
Above answers are all good, but a word of warning. If you bring Child Protective Services into it, they will remove the child if they deem the household to be unfit. Courts generally prefer to keep a child with another family member if they can, but that means your home may come under scrutiny, and if not up to snuff, or if they feel you are not capable of adequately caring for the child for some reason, the child may end up in a foster home. GET A LAWYER.