The Prophet (peace and blessings of Allaah be upon him) described gheebah (backbiting) as being “Your mentioning about your brother something that he dislikes.” If the quality that is disliked is not actually present, then it is a lie, and both of them are haraam.
Muslim (2589) narrated from Abu Hurayrah that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Do you know what backbiting is?” They said: Allaah and His Messenger know best. He said: “When you say about your brother something that he dislikes.” They said: What if what I say about my brother is true? He said: “If it is true then you have backbitten about him and if it is not true then you have told a grave lie about him.”
Based on this, your saying bad things about this person in his absence must be either backbiting or lying, so what you have to do is repent to Allaah and resolve not to do this again. Part of repenting fully is striving to correct your feelings towards him, praying for forgiveness for him and mentioning his good qualities before those in whose presence you spoke ill of him. See the answer to question no. 52807.
This applies if the words were said in his absence. But if they were said in his presence, then this comes under the heading of reviling, insulting and rudeness, which is also haraam, so long as there was no retaliation, i.e., responding to bad words in kind without overstepping the mark.
That is because Allaah says (interpretation of the meaning):
“The recompense for an evil is an evil like thereof; but whoever forgives and makes reconciliation, his reward is with Allaah. Verily, He likes not the Zaalimoon (oppressors, polytheists, and wrongdoers).
41. And indeed whosoever takes revenge after he has suffered wrong, for such there is no way (of blame) against them.
42. The way (of blame) is only against those who oppress men and rebel in the earth without justification; for such there will be a painful torment.
43. And verily, whosoever shows patience and forgives, that would truly be from the things recommended by Allaah”
And Muslim (2587) narrated from Abu Hurayrah that the Prophet (peace and blessings of Allaah be upon him) said: “When two people revile one another, the one who starts it is the sinner, so long as the one who is wronged does not overstep the mark.”
It says in Subul al-Salaam (2/675): The hadeeth indicates that it is permissible to respond in kind to the one who insulted one first, and that the sin of that will come back on the one who started it, because he is the cause of everything that the one who is answering back says, unless the one who is answering back oversteps the mark, in which case the sin of aggression is borne by him, because the permission is granted to respond only to the same extent as the initial offence: “The recompense for an evil is an evil like thereof” [al-Shoora 42:4] and “Then whoever transgresses the prohibition against you, you transgress likewise against him” [al-Baqarah 2:194].
But not responding in kind, being patient and putting up with it is better. It is proven that a man reviled Abu Bakr (may Allaah be pleased with him) in the presence of the Prophet (peace and blessings of Allaah be upon him) and Abu Bakr kept quiet whilst the Prophet (peace and blessings of Allaah be upon him) was sitting there. When Abu Bakr responded, the Prophet (peace and blessings of Allaah be upon him) got up and left. He was asked about that and he said: “When Abu Bakr kept quiet there was an angel responding on his behalf, but when he stood up for himself, the shaytaan came,” or words to that effect. Allaah says (interpretation of the meaning):
“And verily, whosoever shows patience and forgives, that would truly be from the things recommended by Allaah”
But if you respond to this mistreatment by speaking and acting kindly towards him, and being gentle and nice, and obey Allaah with regard to him when he disobeys Him with regard to you, that is the status of people of a high level of taqwa (piety), which only a few can attain.
Allaah says (interpretation of the meaning):
“The good deed and the evil deed cannot be equal. Repel (the evil) with one which is better (i.e. Allaah orders the faithful believers to be patient at the time of anger, and to excuse those who treat them badly) then verily he, between whom and you there was enmity, (will become) as though he was a close friend.
35. But none is granted it (the above quality) except those who are patient — and none is granted it except the owner of the great portion (of happiness in the Hereafter, i.e., Paradise and of a high moral character) in this world”
May Allaah help us and you to do that which He loves and which pleases Him.
And Allaah knows best.