my 4 year old has the same problem. she had a binkie and once we took that away, she started nibbling her nails, hands and feet. more recently she's pulled one halfway off her toe. she does it when she's watching tv or going to sleep. i'm sorry i have no advice how to get them to stop cause i've had no luck. i tried painting her nails so maybe she'll keep them pretty but she didn't care. she has fun picking the paint off first and then biting her nails.
i've heard that you're not supposed to make a big deal out of it cause they don't even realize they're doing it so making them feel bad won't help. if you figure something out, let me know!