I had been eating before I visited you.
I had eaten before I visited you.
How do you know when to use either of them?
It depends largely on what you want to say,i.e. your intention. If you want to emphasize the action of eating as extending over a period of time in the past and having a specific outcome or relation to a later point in the past, so, you should use the past perfect contiuous " I had been eating before....". This means the actions of eating and visiting are close in terms of time of doing them and that you are not hungry now. However, if you just want to state what happened with you in the past chronologically, you use the past perfect "I had eaten before.....". In this case you refer to the fact that you "ate" then "visited" respectively.
I had been eating before I visited you describes that you were in the process of eating before you visited the person. I believe this is called past perfect continuous.
I had eaten before I visited you describes that you had already eaten before you visited the person. This is called past perfect.
There are three possibilities here, with slight differences in meaning:
1) I ate before I visited you. - a statement of fact with no emphasis
2) I had eaten before I visited you. - so I wasn't hungry
3) I had been eating before I visited you - implies the meal was interrupted
(It's the past of: Why is your tongue red? I've been eating chili peppers.)
In other words, one action has an effect on another action.
(If I hadn't gone to visit you at that moment, I would've finished my meal.)