Mass Fusion is where you can make another faction an enemy
Make sure to make a save file when you reach the quest "Mass Fusion", because if you continue with this quest and side with The Institute, you will become enemies with The Brotherhood Of Steel. You are given the option to go inform The Brotherhood which becomes the quest "Spoils Of War". Continuing this quest will make you enemies with The Institute.
Siding with The Institute will also let you continue "Underground Undercover" with The Railroad.
Upon finishing "Mass Fusion" for The Institute, you will be given a quest called "Pinned" which can make you an enemy with either The Institute or The Minute Men. Simply have The Minute Men stand down through charisma dialogue options to stay allied with both factions.
You will get a quest called "End Of The Line", for obvious reasons you're not going to want to do it so you can stay allied with The Railroad. When you get "End Of The Line" a Synth will come up to you while at The Institute to relay a message to you that will allow you to continue The Railroad quests.
You can continue The Railroad missions now with no worries and get Rockets' Red Glare, which is the last of The Railroad trophies.
Once you've finished The Railroad's quests, you can go on and side with The Institute or reload your save and work with The Brotherhood Of Steel.