To have a grievance with someone, especially where one feels the need to seek damaging retribution.
The phrase probably originates from the act of sharpening an axe with a grinding wheel, with the intent (in this definition) to get revenge on someone by maiming or killing them. ;)
"Five years ago that guy stole my idea for an invention and made tons of money off it! I've had an axe to grind with him ever since. My latest invention will put him out of business for sure, you'll see! Muwahahahaha!!"