You have to identify whether or not it is a form of sensory input for him. If so, you need to have a more appropriate behavior to take its place. When you see him biting his nails,give him a chewy tube or something like it. I hope that makes sense to you.
This works great. Helped my son stop thumb sucking.
There is something you can buy on amazon. I think it's called mavala stop and it is all natural. You just paint it on his nails and toe nails and the flavor should keep him from biting. It is very very bitter!