Boston Scientific has agreed to buy privately held medical- technology company Cortex from medical-device investor Ajax Health in a deal that bolsters its electrophysiology portfolio.