You can't prove the balls are the same if you only have two balls with no means of testing the difference.
This is essentially asking for proof of philosophical zombies (the idea that two physically identical objects are different in some undefinable way, while being identical in every definable way).
Scenario 1: you have a red and green ball. I lie every time, claiming they're the same color.
Scenario 2: you have two red balls. I tell the truth every time, claiming they're the same color.
You don't know the colors, and my claim is the same in both cases, so you can't determine whether my statement is true or false.
Any method you can use to differentiate the balls defeats the zero knowledge portion, but that might be acceptable in some cases. If you modify the conditions to include a known pair of balls that doesn't match, that gives you extra knowledge (the pair doesn't match) by definition. However, no additional knowledge is gained during each test, so it's zero knowledge given the context of additional starting knowledge.
You have a red ball, a green ball, and an unknown ball (that's guaranteed to be red or green). You already know red and green are different (proven by the Wikipedia method), and now you have a third ball. By keeping track of the balls' positions out of my sight, then asking whether the balls match or not, you can determine whether I'm lying or not.
- If I claim red and green are the same, or that red and red or green and green are different, I can't be trusted to know the difference, end test.
- If I consistently say red and green are different, I'm telling the truth.
There are two scenarios: unknown is red, or unknown is green. First, presume unknown is red.
- Lie: If I claim unknown and green are the same, then you can sometimes show me red and green, and sometimes show me unknown and green. Because I don't know which case is happening (because unknown isn't green), I'll get it wrong about half the time.
- Truth: If I claim unknown and red are the same, you can sometimes show me green and red, and sometimes show me unknown and red. Because I'm consistently able to differentiate green from red, while claiming unknown is red, you can know unknown isn't green (or I would have gotten it wrong half the time).
Second, presume unknown is green, then switch the above tests.
- Truth: If I claim unknown and green are the same, you'll show me red and green or unknown and green and I'll consistently get it right.
- Lie: If I claim unknown and red are the same, you'll show me green and red or unknown and red and I'll get it wrong half the time.
In these cases, you don't know which is red and which is green, but you can build collections of red and green balls and determine which collection a new ball belongs to. Of course, if I constantly lie, you can't get any useful information out of me, but you know I'm lying.
Zero Extra Knowledge: To prevent building collections of red and green balls, you can randomly shuffle the known red and green ball after finishing the protocol. Now, you know the unknown ball matches the known ball I claimed it matched, but you can't use that information to match the unknown ball to any particular unknown ball from a previous or future test.
Multiple Discrete Colors
The above won't work with an unknown number of colors. However, it will work for a finite number of discrete colors if you have one of each color already. Essentially, you do tests for each color. For all but one color, I'll easily tell the ball never matches. But for one color, I'll claim they match. I can lie when they clearly don't match, but I can't consistently lie when they do match, as above.
For each color, X:
- Compare unknown to colorX. If I claim they're different, move to next X.
- If I claim unknown matches colorX do a test with each other color, Y.
- Do the test as we did with red and green above, but now with colorX and colorY. If I'm telling the truth, my statements will always be correct.
- If I'm lying (i.e., colorX and unknown don't actually match), there will be a particular colorY that does match unknown, and I won't consistently tell them apart.
Again, you can't determine what color a normal person would use to describe each ball, but you can determine which group to put a new ball in. By shuffling the known balls after the protocol, you can prevent building collections of balls, since you don't know which ball from this test matches the unknown ball in a previous or future test.
Matching the Initial Question Better
The question posits a scenario where I hand you a pair of balls and claim they're the same. Other answers use an independent pair of non-matched balls to test the pair I handed you, and those answers are probably better for general use. However, I went with the idea of using only three balls total, so I'll expand that here since the four-ball solutions already exist.
I'll hand you three balls, call them A, B, and C, and tell you A and B match, while C doesn't. There is still a requirement that you somehow know each ball must be red or green.
1,. You use the standard Wikipedia protocol to prove that C doesn't match A (shuffle A and C and if I get it right consistently I can clearly differentiate between them).
2a. EITHER use my protocol to prove that B matches A. If it matches A, I was right.
2b. OR use the standard protocol to prove that C also doesn't match B. Because C doesn't match A or B, A must match B. If C doesn't match B, I was right.
This is still not zero knowledge in the context of the original question, because you've learned not only that A matches B, but that A and B don't match C. However, I think it's the minimal amount of extra knowledge you can gain while proving A matches B.
This can still be expanded for many colors.
- I hand you balls A, B, [$C_1$, $C_2$, ... $C_n$].
- For each pair in [B, [$C$]] you prove that pair is distinct using the Wikipedia method.
- Then you prove that A doesn't match anything but B.
Again, there's the requirement you somehow know there can only be (n+1) ball colors.
I don't know if any of the above is actually useful in a real-world application, but I think it's a sufficient answer to your question. None of the given answers are truly zero knowledge, but do allow for zero extra knowledge given the modified constraints.