Now, I use a lot of humanoid Npcs, and those are the ones I primarily see as worth a little bit of spotlight time, seeing as they are supposed to represent living breathing creatures with a life, a history and goals. But of course your Npcs don't have to be bipedal, they might be manticores, dragons or what have you. The point is that they are intelligent and possess some form of communication skills, even if it's only facial expressions or grunts. Even goblins have some form of a culture after all. But ultimately you have to decide where you want to draw the line, which Npcs are(in your mind) worthy of being treated humanely.
You as a DM, need to ask yourself five questions;
1. Does the Npc interact with the players in any other way besides taunts/threats/monologuing?
If not, what possible reason would they have for treating the Npc as anything other than a hurdle?
I'm not saying they should get the lifestories of every Npc they meet, nor that every situation warrants the plausible alternative for some friendly banter. But let's have a little example; Your PCs are in the process of infiltrating a castle and they happen upon some guards who for story reasons if nothing else, haven't spotted the players yet. Battle might seem unavoidable, but even so, how do you handle things?
Do you just listen to the PCs make their plans while your Npcs supposedly stand there idly awaiting death? How about instead, you make it a roleplaying opportunity. Have some of your players portray the guards in a little friendly chatter, but give them guidelines so they don't flounder about too much. For instance; "Tom, you will be portraying Gurth(point to the Npc if applicable), Gurth has reasons to complain to his friend Urdo over here, who will be portrayed by you, Harry. And meanwhile, Urdo has some good news he wants to share with his friend Gurth.What has got Gurth in such a foul mood, and what are the good news Urdo wants to share? "
Now all of a sudden, the Npcs become the PCs own little creations, if only for a while. Of course, this could backfire horribly if the PCs decide to portray the Npcs infavorably, which could increase the chance of them killing them, but hey, at least you tried (might work better the next time). And if that doesn't work, there are other methods that might.
2. Are there any consequenses for treating the Npcs badly?
Do you just count the damage, proclaim the Npc dead and that's that? How about some last words, or at least a gruesome description of their oh so unneccesary death every once in a while. Or even better, how about they experience firsthand the loss they've wrought on the families of the Npcs. After their latest slaughter in the nearest dungeon, have some little waif in the nearest town telling them how she is waiting for her father to come home, who just happened to be in the same dungeon our "heroes" just came out from. Whoops...
How about legal issues? While they most likely won't be penalized for killing the evil necromancer up on mount doom, killing the local baron's guards or the team of rival adventurers come to investigate, will and should be a cause for punishment.
Not to mention the many Inigo Montoya moments they ought to be racking up.
"Hello, my name is Inigo Montoya, you killed my father. Prepare to die!"
3. Would they be punished for sparing a life?
Is killing the Npc the easiest, or the only way forward? If so, then you're not doing much to help the problem. You shouldn't expect from your players that they will choose to do something detrimental for their game just because it's supposed to be the right thing. Reward them for talking their way out of situations as you would for combat, or maybe even more so. Then you are making the choice easier for them.
If your game uses exp, you could give them the same amount for succesfully solving a battle peacefully as you would for them winning it through battle. But only give them this sum once, they won't be awarded anything extra if they decide to slaughter the Npcs after parlaying with them. If anything, they should be given a bad reputation for such behaviour.
4. Is there anything tangible in it for them?
Think of the many plot hooks you would get for every foe they spare, both beneficial and detrimental for the party. Some would of course be grateful for having their lives spared, so much so that they might repay the PCs at some other opportunity in any way they can/feel like. While others will hold a grudge for the perceived humiliation and might try to take revenge on them somehow(free villians with history). Of course, don't overdo either aspect. Too many new vengeful enemies and it won't be worth sparing them, while too many new insta-allies run a high risk of being exploitable.
5. Have you talked to your players about this behavior?
It is very important to set the tone, early on. If this is something that bothers you, talk to your players about it. Make them understand that their actions have consequenses, and that you don't condone needless slaughter. Drawing the ire of the DM, is something that most players wish to avoid. If you're not voicing what actions are likely to do that, then you're putting them at an unfair disadvantage.
Some games uses alignment, but even without it, they most likely had a picture in mind when they imagined their character. Most players tend to play as somewhat good aligned characters.
If this is true for your group, ask your players, is this really what your character would do?
Now if they are playing such an unsavoury character, or simply choose to go against their character's nature. Let them. But you might want to think about changing alignment (if applicable) when they go against their character's nature too frequently, also make them aware of this conduct before you do so.
You could also ask your players if their characters feel guilty after killing someone. The mere question might be enough to make them think twice, before jumping into a murder-spree the next time, given the chance.
And remember, don't overdo any of these, use sparingly for greater effect and to avoid irking your players.
I hope this was of some use, even if most of it is just common sense and platitudes. But I think we all need to be reminded of the obvious every once in a while, just like your players.