By the rules
If you want to use mechanics as much as possible, you could start by having the horses frightened or even panicked (not much difference for NPCs). The storm being what scares them, "fleeing away from the source" is technically impossible so it turns into random fleeing. In such situations, horses tend to scatter.
To deal with the situations, PCs would have a few solutions:
- If anyone has Handle Animal trained, they could use it to Handle the horses, ordering them to Stay or Come. It's usually a DC 10 check but considering the unusual situation, it wouldn't be strange to raise the DC as if the animals were wounded (+2 to DC, or more if you think it's appropriate).
- This may have to be done for as long as the horses remain within the storm. Finding a shelter is paramount.
- They could try to Grapple with them or use Lassos to direct them to a safer place.
- You may consider the Ride skill use to Control mount in battle, a DC 20 check, as appropriate to control the horses in spite of their fear
- They may use various spells creatively to hinder the horses movement or block out the source of their fear.
- You may be able to push the horses into a Secure Shelter until the storm subsides.
- You could deafen the horses and/or blind them to stop them from perceiving the source of their fear. Being deaf or blind might freak them out differently though...
- You could use Grease or Entangle to slow them down, if not stop them outright
As for staying the saddle when they rear, this is a DC 5 Ride check, along with a DC 15 Ride check to soften the fall in case they fail that first one.
As a skill challenge
If you want to go for something less strict and more drama-oriented, you could ask the players how they plan to solve the situation and come up with appropriate ability and skill checks as rulings. They may need a given number of successes to get all the horses to safety before getting a number of failures. The total tally would give a sense of how they did, possibly letting one or more mounts escape, to be retrieved later or lost forever, depending on how long-lasting you want the results to be.
You could also rely on your sense of drama to decide what happens on each success and failure, depending on the actions being attempted, and to find the right moment to consider the scene over.
It's not unusual to reward a creature's XP, as if it had been defeated in combat, whenever it's involved in such challenges. You could give them XP for each horse they managed to secure for example.
Another way to do it is to consider the challenge as a whole and establish the goal you expect them to accomplish. You could say you expect them to keep all the horses safe for this to be a success. Or maybe you think this is rather difficult (especially if the party does not have the right skills, spells, etc...) so securing at least half the mounts would be quite the success. You will have to use gut feeling or your experience GMing for this group to get a sense of this. Whichever goal you use, if it's accomplished, give them XP for an encounter of a CR equal to their APL (Average Party Level). You can adjust that from CR-2 to CR+2 if you think this challenge is easy or hard compared to a regular CR=APL fight.
I'd also suggest remaining open to unexpected developments. If you realize the challenge is much harder than you imagined for this party (and the players are genuinely having trouble), give more XP than you had planned. On the other hand, if they make it seem like a cakewalk without even trying (no clever solutions nor luck of the dice), then maybe you overestimated the challenge and it's worth less XP. In that last case, you could also savor some humble pie and award them the initial XP amount and remember it as a lesson for your next XP estimations.
Finally, if the players come up with extremely clever solutions or really go out of their way to solve the challenge, you may decide it's worth some extra XP, if only as incentive for them to keep playing that way :)