No it's not an AI command, it's just a natural responce, Just like a marine stims himself when up against specific units.
http://www.staredit.net/index.php?showtutorial=69 (scroll to Yamato Gun)
- Yamato Gun -
*Seems to like to use it on high level units that are attacking its units/buildings (they like to use it on archons, science vessels, other BCs, but don't seem to want to use Yamato on heroes)
*Can be hard to determine which one or when it will use it because BCs anywhere on the map will run up to use Yamato on an attacking unit. They will also use it in response to help an alli that is being attacked too
*Note: When the BC is moving its way to the unit it wants to Yamato and another unit gets in the way it may change orders and attack (probably not with its Yamato) that unit instead
*Using a Terran AI scripts seems to make them use it more often and aggressively, after a while if you don't have a terran script running the BCs might stop using it
You trick him into firing it, move him accross the map, time it just right and do whatever. Personally I think it's too much hassle, but it would be cool to see A ton of them fly over the sky, like maybe a spell in some RPG.
Edit: And again, make sure the computer that owns the cruiser HAS the Yamato ability!!