How to make a film in black and white with some objects in color Final Cut Pro X
The simplest way to do this (also known as the Pleasantville effect) is to apply a Color Correction effect to your clip and then do the following:

Click on the Color Board to open the Color / Saturation / Exposure menu.  Select the Saturation menu and pull the Global (leftmost) slider to the bottom.  Your image should be fully desaturated.

Return to the Color Correction menu and select Add Color Mask.  It's disguised with an icon that shows an oval in a square.  When the eyedropper is blue (default), you can click (or better, click-drag) a spot on your image that has the color you want to preserve.  You can do this again and again until you get enough of the color selected to achieve the effect you want.  Select Invert Mask to get only the color you selected, or leave the mask as-is to desaturate only the color you selected.

This will work well for simple cases, but it is a far cry from the HSL qualifiers offered in programs like DaVinci Resolve, for many reasons.

A much, much more complicated thing to do is to use masks and manually composite in FCPX.  Compared with other NLEs, which all seem very intuitive to me, FCPX utterly baffles me when it comes to masks and layers.  YMMV.