FBBIK tries to maintain the animated bending direction of the limb. If it bends like that, that means in the animation the leg bends in that direction and while the leg is straight it's not really visible, but when the Grounder moves the foot up, the problem becomes more visible. It might be a retargeting issue, where the leg angles don't retarget well for that particular Humanoid.
A quick fix would be to add Bend Goals for the legs, parent them to the root of the character and move them to a position in front of the knees. Also set "Bend Goal Weight" to 1 in the FBBIK leg settings. That way you'll get full control over the bending angle of the knees.
Sometimes it also helps to enable "Foot IK" in the locomotion animation states to improve the retargeting.
Sometimes it helps to go to the Avatar Configuration screen and rotate the thigh and knee bones very slightly inwards (like X legs). If you saw the opposite problem, you'd have to rotate them outwards (like O legs).
If none of that helps, I'll be happy to take a look at it if you can send me that character and animation fbx. (firstname.lastname@example.org)