Before we can begin work on the episode itself, there are several important points of background and context which much be addressed first.
Why is this episode happening at all?
When it came time to pick the commander of the Babylon 5 station, the Minbari vetoed every name that came up until they got to Jeffrey Sinclair (who was pretty far down the list). EarthGov doesn't know why, just as they don't know they the Minbari surrendered ten years earlier, after slaughtering many thousands of EarthForce troops and putting the whole planet through essentially a mock execution. EarthGov is aware, however, that there is something odd (and concerning) about Sinclair's past: he flew a suicide mission at the Minbari mothership, they captured him instead, and a day later, the released him and ended the war - but his ship's computer has no records of what took place inside the Minbari ship, and all Sinclair's memories of that day have been erased from his mind. Everyone also knows the Minbari have telepaths.
The overwhelmingly logical conclusion here is that Sinclair is a Minbari sleeper agent - that they captured him and programmed him, and at some point of their choosing, they can "slip the switch" and make him loyal only to them. This would explain why they vetoed everyone until his name came up. Earth concludes that they're letting him run the station nominally, supposedly honoring the agreement that Earth would have command of the station, but they have something up their sleeve, and he's a compromised officer. (It's not true, but it is the logical conclusion.)
This raises some big, big concerns in EarthGov, especially with then-VP Morgan Clark, who really hates the Minbari (well, all aliens, but especially the Minbari).
So Earth wants him replaced, and this episode is the plan they've come up with to do it. The Senate approves a change in telepath policy allowing for limited "loyalty scans" under very specific circumstances, and they hope that such a scan will discover evidence of the Minbari "program." The whole thing is a ploy to get Sinclair out - they just have to scan the whole command staff so what they're up to isn't as obvious.
Is there a Bester connection?
No, not really. The command staff assumes so, after the Epic Mess that went down in Mind War (more on that episode later), but Harriman Gray (as he says in the episode) has never met Bester, and it's not even clear that the colonel has either. If they have met, they're not "buddies" - Bester isn't "buddies" with anyone, especially not normals. They very well could have met and worked together briefly during the Earth-Minbari War ten years earlier, when Bester was on the top-secret EarthForce/Psi Corps joint base on Ganymede, performing highly classified rendition scans on captured Minbari prisoners (more on this later also). So the command staff having found records that indicate they were once in the same place at the same time isn't strange.
The colonel isn't once mentioned in the books. Their connection is tenuous. Bester has more important things to do than worry about Sinclair or plot to get him removed - and replaced with another normal who may be just as bad for the Corps, anyway. He has a life, and the Babylon 5 station is not the center of it. It's more a case of opportunity.
It seems that Bester has (indirectly or directly) made the colonel aware of the mess that went down in Mind War (namely that he, Bester, had a dangerous rogue telepath in custody, Sinclair blew his top and punched Bester in the face, Bester lost control of the rogue as a result of the assault, and the rogue killed Bester's associate, another Psi Cop named Kelsey). Is he "plotting against Sinclair"? I doubt it. It looks to me more like a case of good timing - EarthGov wanted some good dirt on Sinclair, and he happened to have it, since the events of Mind War happened only a couple weeks before. In a logical world, Sinclair's assault on a police officer (resulting in the death of another) would be conduct unbecoming an officer, if not criminal - but Normal Privilege and all that.
Who is this colonel Earth chooses to depose Sinclair?
He's a well-respected colonel in EarthForce, a tough-ass, and a close friend of Morgan Clark. He is especially angry that Sinclair, who he considers an inferior officer in every way, got the job over him. He feels command should have been his, and would be more than happy to see Sinclair revealed to be a Minbari agent and kicked out on his ass.
There's also some apparent shenanigans with his name, with is actually Ari Ben-Zion, not "ben Zayn." Though pronounced the same (in English), this isn't the same at all. "Zayn" is an alternate spelling of "zayin," which is the Hebrew alphabet letter for "z," making his name "son of the letter z" (not a name, as far as I am aware). Additionally, this Hebrew letter, because of its shape, happens to also be common slang for "dick" in modern Hebrew. (And Zein/Zain is a family name in Arabic, not Hebrew.)
I don't know if they intentionally spelled his name that way to call him "son of a dick," or if this was an accident, but either way, I'm fixing it.
Who is Harriman Gray?
Gray comes from an EarthForce family. Growing up, his dream was to be a pilot, like his father. He collected flight patches, built model planes and starships, and when he was accepted to EarthDome at 16 (and entered at 17), it seemed his dream would come true. Then four weeks into basic training, he developed telepathy, and was kicked out on an administrative discharge because telepaths are not allowed to serve.
Devastated, he almost took his own life. But within a few days of his discharge, he was contacted by the Corps, and they took him in and helped him rebuild his life. They offered him the next best alternative to serving in EarthForce (as permitted by normal-written laws) - to work as as telepath "attache" to EarthForce.
Most telepaths who work in support roles with EarthForce perform similar duties to their counterparts out in the civilian world, or at least parallel duties - telepaths oversee contract negotiations and are present at courts-martial - but some serve as personal attaches to high-ranking members of the military. Commonly (and somewhat derogatorily) referred to as "pet" telepaths or "lapdog" telepaths, their role is basically that - to be the "private" telepath to some very powerful normal. At some point, Gray ended up in this role with Col. Ben-Zion. He may have been recently appointed, or he may have been working in that capacity for years, before the change in regulations that allowed for so-called "loyalty scans."