If you can have someone hold his head while you take a warm washcloth and some mild soap to clean it up that would be best then you can get a better look at it. The bad thing is that it also makes you the bad guy which is something you want to avoid. Above all, DON'T get bit! He's hurting and not trying to be malicous but he doesn't have any other way to tell you he's in pain. If its near the bed of the nail, or if it IS from the nail growing into the pad then, depending how bad, try and clean it up as best you can, place some neosporin on it and place a sock over it so 1. it stays clean and 2. he stops licking it. If it is a nail growing into the pad, it needs to be cut out and that is also very painful. You can choose to do this yourself or take him to your vet so they can do it. If you decide to do it, just realize it probably will bleed so have some quik-stop type powder on hand to stop the bleeding.
Sometimes when the nail grows too long it will crack at the base wich will cause it to become very sore and thats one thing it could be. His licking may be irritating the area also causing somewhat of a granuloma. What happens is something sets them off to start the licking whether it be an injury or just boredom or just being neortic(dobermans are nortorious for this..I know, I have one) anyway, the licking causes irritation and the irritation causes licking so the cycle continues....Thats just a couple of the things that may be causing it.
Hope this helps