The comparison has to do with the Greek word paradidomi. Literally, paradidomi means "to hand over." The word is used a little over 120 times in the NT, and 44 of those references are applied to Judas. In the uses outside of Judas the meaning of paradidomi is generally rendered as the morally neutral "to hand over." But when applied to Judas the translations shift to the morally loaded rendering of "betray." But what if, as some scholars have suggested, we kept consistent and rendered paradidomi as "to hand over" in the Judas episodes? How might that affect how we read the story and understand Judas?
This question is made more interesting when we examine how the gospels treat Judas. The two earliest gospels--Matthew and Mark--tend to have rather neutral takes on Judas. Matthew and Mark tend to see Judas simply one instance among the collective betrayal of all Jesus's followers. But in the later gospels, Luke and John, Judas is a more sinister character, even diabolical. (For a summary of all this see my post here.)
And things get even more interesting when we look at Gnostic texts like the Gospel of Judas where Judas is seen as aiding Jesus, helping Jesus get to the cross so that Jesus could escape his body. (Gnostics had a dim view of human corporeality.)
And while seeing Judas as a hero might seem far fetched to many conservative Christians, there is an ambivalence surrounding his actions. Specifically, if salvation is reduced to Jesus's death on the cross, if all that is really important about Jesus is that he gets killed, then how do you not avoid seeing Judas in a somewhat sympathetic light? By handing Jesus over isn't Judas participating in our salvation? On the human level Judas's actions are a "betrayal," but on another level Judas is, apparently, a critical player in the drama of the crucifixion as he is the one who "hands over" Jesus to the Jewish authorities. For the death of Jesus to occur (and salvation inaugurated) the "handing over" is the critical part. Whether or not that "handing over" was a "betrayal" is, from one perspective, largely irrelevant. Thus the ambivalence. The "handing over" is sort of bad and sort of good, depending upon how you look at it.
Which brings us to Severus Snape.
At the end of The Half-Blood Prince (Book Six in the Harry Potter series) Snape is revealed, finally in the eyes of readers, as the Judas we've always suspected him to be. Snape kills Dumbledore.
But all this is turned on its head in the final book, The Deathly Hallows, when we, in the last moments of Snape's life, discover that Snape's betrayal was actually a part of Dumbledore's plan. And the plan had a salvific purpose as it was meant to save the soul of Draco Malfoy.
In the end, Snape's "betrayal" was sort of a bad thing and sort of a good thing, depending upon how you look at it.