While working under the same roof, for the same boss, and facing somewhat similar challenges and stresses, it is understandable to develop some grudges with a colleague or do something to offend him/her. Meeting the same people every single day, and competing with them on a regular basis, greatly increases the chances of an argument eruption or a clash of egos. While arguing or even fighting is unavoidable, it is your moral and ethical obligation to apologize to your colleague if you are at fault. An apology email is the best alternative to the sometimes embarrassing face-to-face interaction after a bitter spat.
In the first paragraph of your apology email to your colleague, tell the person of interest that you have realized your mistake and deeply regret it. In the second paragraph, try to explain your position and why you did or said whatever it was that you did or say. In the final paragraph, convince him/her that you are indeed sorry and that you will make sure not to repeat your mistake again.