Find a place to mount a three-way valve on the wall close to your washing machine. Make sure the position you choose is above the flood rim of your washer. This is the point at which your machine would overflow, either above the door on a top loader or above the top of the drum on a front loader.
Secure mounting brackets to a piece of wood and drill pilot holes into the wall. Screw the wood to the wall and attach the three-way valve to its mounting brackets.
Connect the drain from the washing machine to the valve's inlet and secure it in place with a hose clamp.
Screw a connector to one outlet of the three-way valve and run pipe to the clean sewage system the appliance was connected to. The amount of pipe you'll need will depend on how far away the valve is from your drainage system. Use PVC glue to connect the lengths of pipe together.
Screw a connector to the other outlet on the valve and run pipe to your greywater recycling system, gluing pieces together as you work. Again, the amount of piping you'll need will depend on the distance from the valve to your greywater drainage system.
Affix labels to your wall to show how the appliance's waste water will be routed when the valve is switched.