There's no major difference between them.
We say it as an expression of regret or sympathy. It is much more common to use 'that,' instead of it.'
For example, let's say that you saw something on a market stall that you wanted to buy. You went off to get the money to buy it and then went back to the stall, only to find that the item had been sold. When the owner of the stall tells you that they have sold it, you might say 'That's a shame.'