Is bear spray (pepper spray specially formulated to be effective against bear attacks) effective against other animals, especially mountain lions or wolves? Or is there something in it specifically targeted towards bears that would make it less effective on other attacking animals?
Given that the active ingredient is capsaicin which is used in self-defence sprays for all types of purposes, bear spray should be effective on anything with tear ducts, soft tissue, sinuses, eyeballs, etc, (and will totally dominate a bean burrito**).
The discriminating difference between "bear spray" vs "self-defense" spray, vs. law enforcement "occupy-protester" spray is a combination of volume, range, spray pattern, and percent capsaicin and oleoresin capsicum (capsaicin is what gives the spray the "heat" ranging in the 1-3% range, while oleoresin capsicum is pepper oil extract that contains the capsaicin).
Other than that, it is all essentially the same stuff, and has been used effectively against bear, moose, dogs, cats, and people.
However, as pointed out in other answers, each animal's behavior / attack pattern varies, meaning your ability to implement pepper spray in a timely effective manner may be limited. Knowing what threats are in the area you are traveling, and the best way to prevent an encounter in the first place is your BEST plan.
**NOTE: although capsaicin IS the same thing that gives chillies their heat, (and in fact is isolated from chillies) DO NOT use bear spray or other self defense sprays as a flavor enhancer. I point it out as a segue to illustrate that Pepper spray is only effective as an active counter-attack measure sprayed directly in the face of an assailant, and should NOT be used as a "repellent." There have been reports of people spraying bear-spray on their tents and sleeping bags like mosquito repellent which is basically the same as turning yourself into bear-sized buffalo wings.
According to this account: Idaho bicyclist rescued from pursuing wolf , bear spray did not deter this particular wolf (dog?). So, case study of 1...
Chemically, if you can use it, I see no reason why it wouldn't work on any similar animals - though practically it may not be as effective. In terms of cougars for instance, this seems to imply it'll work if you can get it out and use it in time, but because of their nature the chances of you being able to carry out the task successfully are dramatically less for a cougar than a bear.
Most material seems to imply that for wolves it's better to make yourself look big (less like prey), get children behind you and face the wolf rather than using spray, so I'd try that first and hopefully it won't get on close enough quarters to warrant using the spray!
The other answers sum it up great for the most part: it will work on other mammals if you have a chance to use it. It's pretty strong stuff, and while I could imagine something like a bull elephant in musth shrugging it off, in general it will work.
It will not work on birds though, as many a mailman using pepper spray against defensive geese and turkeys has found out. They don't have the right receptors. That's how peppers evolved to be hot in the first place, it shoos off any large browsing mammals with a digestive tract capable of digesting the seeds, but allows the fruit to be eaten by birds that spread the seeds.
Other animals like crocodiles and sharks (although using bear mace underwater doesn't sound like the greatest idea to begin with) from what I can find fall closer to the bird side of the comparison, and bear mace will not work.
As a final legal notice: bear mace is really strong stuff. You should never feel discouraged to use what you have in a serious self defense situation, but under all other circumstances do not use it on humans in any way. It's formulated to stop the closest thing this world has to movie monsters, it's bad stuff.