I'm not to sure, but I believe it's
recorded data form players who played in the arcades. The game reads their tendencies, juggles, pokes, and even setups on occasion, and tries to imitate them. I believe in tekken 6, you could download ghosts from online players as well.
I've been begging that MK10 or injustice has a ghost system, because the AI would be much better. In tekken 6, then game could record your own tendencies as well, and you could even face your own ghost in ghost battle, but I'm not sure it works for TekkenTag 2.
It's almost the equivalent of Reo playing as Kabal, the game records his tendencies and setups (Iagb, percentage of sweeps, dash cancels), and uses it for AI in a continual arcade mode filled with other ghost. The only issue with ghost battle is that the AI doesn't
backdash cancel or space. Hope that explains it