Searching for gamma-ray counterparts to gravitational waves from merging binary neutron stars with the Cherenkov Telescope Array