It is interesting to note the reaction people have when they notice some dearly beloved symbol being offended, even if strictly no physical harm is done. Consider the reaction you might get, for example, if you drive around certain parts of downtown flying a Confederate flag from the back of your truck; or if you use an American flag as a doormat; or even if you insult a beloved and dearly departed figure of national history. These actions are not strictly speaking harmful: no one will bleed if you use the American flag to wipe your feet as you enter the house. But plenty of people take great offense at these symbolic acts of rejection and irreverence, and oftentimes the response is even violent.
Why is this? I take it this happens because we understand something to be of great value, and that valued demands a corresponding respect in the behavior of others. Some things are to be respected and treated with dignity because they are good, and the opposite behavior is subject to punishment and censure. This is true even if the beloved object which has been insulted is incapable of harm -- say because an American flag is not sentient at all, or because the dearly beloved person who has been insulted is dead and so incapable of suffering harm.
This shows that the gravity of an immoral act is not always a function of the harm it produced. Some things can be deeply immoral and consequently censurable even if they are not strictly speaking harmful.
These reflections help us to understand the Christian claim that sins against God are especially heinous. This is because God represents the ultimate value; everything else is truly good only thanks to some resemblance to and participation in the goodness which God is himself. God is the paradigm and embodiment of intrinsic value; nothing could be good unless God himself shared some goodness with it in some way or other. Because God is the Good Itself, consequently sins against God -- refusal to live in keeping with God's will -- are all the more heinous. It is not merely some good person or good thing which has been insulted; it is the Good itself, it is value itself, it is goodness and meaning and life itself which has been insulted and rejected.
Now of course God cannot be harmed by anything we do. This is the classical theistic doctrine of God's impassibility: he is incapable of suffering harm or of being affected by anything we do. But we have already seen that the gravity of an act does not necessarily consist in the harm it produces in another being. The gravity of sin comes not from the supposition that God has been harmed in some way, but rather from the insult and attitude implicit in a rejection of Goodness itself.
Certainly not every sin is on a par. Some sins represent more heinous rejections of goodness than others, and not every sin is undertaken in a manner that is fully responsible. Many people reject God but out of an ignorance of who he is: they do not know that God is the Good; they think of him as just another being among beings, and a particularly annoying one at that, who is just concerned to keep us from having fun. A person like that who rejects God doesn't know what he's rejecting, and although serious, I should think his sin is less grave. But a person who understands and sees clearly that God represents the paradigm of value, and that consequently a life should be lived in keeping with God's will, but instead rejects God because only in this manner can he act as his own guide and source of value in life -- such a person's sin is truly mortal and deserves infinite punishment. A rejection of the Good itself, of everything that is valuable and intrinsically worthy of dignity and worship and respect: this is the attitude of an utter reprobate who deserves punishment by any reasonable judgment.
Because sin is so grave, consequently we ought to be so careful in our own lives. Too often we are tricked into thinking that sin is not bad, that is really a "forbidden pleasure," and the more we ruminate on the pleasure, the less reasonable we find that it is forbidden. We have to remind ourselves what is really at stake in an act of sin: it is an act of cosmic rebellion and a usurping of true and proper values. Furthermore, because sin is so grave, it is therefore all the more wondrous and unbelievable that God himself, the Good against whom we sin and insult, took on human nature in Jesus Christ and made atonement for our sins through his life and his cross. The Good, though we insult him, wants our salvation and not our death. Beyond teaching us what is right and wrong, he makes efforts to bring us in line with the truth in our actions as well, and does everything in his providence to keep us from punishment. Thanks be to God!