You might have thought occasionally, with holy envy, about the adolescent Apostle John, quem diligebat Iesus – whom Jesus loved. Wouldn’t you like to deserve to be called ‘the one who loves the Will of God’? Then take the necessary steps, day after day. (St. Josemarie Escriva, The Forge)
St. Thomas Aquinas defines envy as sadness over some good or excellence another person possesses, inasmuch as one perceives this good or excellence as taking away from one's own good. Understood in this way, envy is said to be bad "in itself", and indeed "in its species"
Now the focus of a person's sadness might be on his own not having what the other person has, with an accompanying wish to have it himself, or it might be on the other person's having what he doesn't, with the accompanying wish that the other not have it. (He gets to have a day off, and I don't! If he gets to, then I should too!… I don't get to have a day off, but he does! If I can't have one, he shouldn't either!)
While the latter type of envy is the worse of the two, both types are bad if and inasmuch as they consider the good of another person, in relation to one's good, as something bad and undesirable. This is contrary both to truth and to charity: to truth, since it is not truly bad, but good; to charity, which seeks the good of others.
What about "holy envy"? How does that relate to the usual meaning of envy?
While there are a couple of usages of holy envy, the most exemplary one is probably an admiration for a true and noble good that another person has, which one either cannot or does not have, accompanied by a longing so strong as to cause pain, or nearly do so. Inasmuch as there is a pain involved, a pain that somehow arises from not having something someone else has, it is similar to envy in the usual sense of the term. The difference is that the pain or sadness is not really about the other person's possession of good, but is caused by one's own great desire to possess that good. Supposing that this yearning and any consequent pain is not excessive, but remains without reason, and is not depressing, but motivating one to pursue that good, this yearning is itself good. This yearning for something truly good that one sees in another, this great desire that is or verges on being painful, is what is meant by "holy envy."