Roaming legendaries can be hard to catch, but there are some things that can prevent them from running. Mean look: This move prevents Pokemon from switching out or fleeing when used (Note Mean look will wear off after a little while) Arena Trap: This ability prevents Pokemon from fleeing or switching out. (Note, Arena trap does not work on Flying Types or Pokemon with levitate) Shadow Tag: This ability Prevents Pokemon from switching out or fleeing. Block: Same as above. (Thanks Radicool!)
If you talking about Articuno/Zapdos/Moltres in Pokemon X/Y, they will automatically flee, you can catch them at the sea spirit's den after encountering it 15 (Might be 10) times.
Pokemon that can learn mean look Pokemon with Arena Trap Pokemon with Shadow Tag Pokemon that can learn Block Hope I helped!