According to Aquinas, religion is a moral virtue by which one does well in rendering what is due to God. However, all moral virtues are described by the doctrine of the mean: they are means between extremes of defect and excess. The vice of excess that is opposed to religion is called 'superstition'.
However, there is an initial problem here. By its very nature, we cannot render what is due to God in such a way as to equal what God deserves. How then can we have an excess here? It's possible to have an excess because of an important feature of the doctrine of the mean that is overlooked. It is true that the golden mean lies between extremes, but these extremes can be extremes of conditions or circumstances of the act as well as extremes of the basic act. In this case, while the act of religion can never itself be 'too much' if properly directed, one can be excessive in religious devotion by rendering it to things other than God, or by failing to use appropriate means.
The virtue of religion has three primary ends, and these ends structure how Aquinas sees superstition.
(1) The first end of religious acts is to give reverence to God. Failing to do so is a sin of defect, but giving the reverence appropriate to God to something that is not God is a sin of excess and called idolatry. On Aquinas's view this is the most grievous kind of sin possible, although, as always, in particular cases it may be more or less bad due to circumstances, and the less bad cases of idolatry may sometiems be less bad than particular cases of other vices. Idolatry arises for a number of different reasons -- excessive attachment to non-divine things, perversion of our natural inclination to make representations of things, and ignorance of the difference between great creaturely power and truly divine power.
(2) The second end of religious acts is to be taught by God. When we engage in religious acts in order to be taught by something other than God, this is called divination. Aquinas thinks that this often arises through a pathological twist on a natural inclination: we have a natural inclination to know the future by human means (study of causes and the like). But we either get impatient or greedy and want to know the future by more than human means, or to know more of the future than human means (confined to things that happen always or for the most part) allow.
(3) The third end of religious acts is to direct human acts to God. When we adapt these religious acts so that our human acts are directed by them to things other than God, this is superstitious observance or magic. We fall into this vice through using inappropriate means to satisfy our natural inclination to learn things -- hence the longstanding links between the vice of magic and the vice of curiosity (which has to do with trying to learn things we are either not ready or not able to learn without detriment to ourselves or others) -- and through attempting to do things by using mere signs as if they were causes.
All of these are miscarriages of religious actions -- they render religious honor to things other than God. In addition, there is a fourth kind of superstition:
(4) When we really render religious honor to God, but in an inappropriate way, this is undue or inappropriate worship. Aquinas sees these as being a sort of religious lie. Thus someone who insisted on practices contrary to Christian principles or worship (e.g., demanding Jewish circumcision for entrance into the Church), or a priest who insisted on deviating from ecclesiastical requirements and customs in liturgy, is presenting a false sort of worship due to the mismatch between the means he is using and what it is supposed to represent.
All four of these involve a focus on various external features of religious acts, and thus neglect the heart of religious worship.