Habits are extremely important to St. Thomas' moral theology. I do not pretend to be proficient in either aspect of his thought, but what follows is what I have managed to put together about them.
His definition is somewhat difficult to follow, but as best I understand things he defines a habit as a quality by which one is disposed to action - whether good or bad (ST I-II Q49 A2). The Catholic Encyclopedia definition might be more clear:
[A] quality difficult to change, whereby an agent whose nature it is to work one way or another indeterminately, is disposed easily and readily at will to follow this or that particular line of action.The virtues and vices are habits whereby we are disposed to do what is right, or to do what is evil. I don't have a reference for this ready to hand, but St. Thomas has said someplace that we could think of habits as a sort of "second nature" - indeed, that notion has found its way into our everyday language when we say of someone that it is "second nature" for him to do a certain thing, because he does it so well and so readily. Of course, to do right (or wrong) in some particular way isn't really a part of our nature: as humans we all share the same nature, and others may or may not share our dispositions to act in particular ways. But when we have nurtured or otherwise developed habits, they seem to become so much a part of who we are that we commonly think of them as "second nature". It becomes part of who I am, and characterizes me to such an extent, that folks often say things like, "That's just his nature."
One aspect of the definition from the Catholic Encyclopedia that's worth highlighting is that habits are "difficult to change." If we can give them up at the drop of a hat, they aren't really habits. If we give them up "readily" but return to them again, maybe they really are habits: we are accustomed to that behavior, so that it's difficult to change them.
I've talked about this before, and I really think it's critically important and a brilliant insight of Catholic moral theology. We sometimes say of older folks that they are "set in their ways". This is habit at work. I have also heard it said that most conversions to Christ occur among the young (sorry, no link; I heard this back in the mid-80s). This makes perfect sense within the context of habits: the young are not yet so set in their ways, and their patterns of thought and action are not so set in stone as they someday will be. This is also the point of Ecclesiastes 12:
Remember your Creator in the days of your youth, before the evil days come and the years approach of which you will say, I have no pleasure in them; before the sun is darkened, and the light, and the moon, and the stars, while the clouds return after the rain; when the guardians of the house tremble, and the strong men are bent, and the grinders are idle because they are few, and they who look through the windows grow blind; when the doors to the street are shut, and the sound of the mill is low; when one waits for the chirp of a bird, but all the daughters of song are suppressed; and one fears heights, and perils in the street; when the almond tree blooms, and the locust grows sluggish and the caper berry is destroyed, because man goes to his lasting home, and mourners go about the streets; before the silver cord is snapped and the golden bowl is broken, and the pitcher is shattered at the spring, and the broken pulley falls into the well, and the dust returns to the earth as it once was, and the life-breath returns to God who gave it.I observe in myself how difficult it is to break habits now, and how difficult to build new ones. Far better to do so when young (and I'm not really all that old), when these things are easier. Habits can be a wonderful blessing, but they can also become a curse that we bring upon ourselves.