The tub spout outlet must be higher than the flood rim of the tub to preclude possible backflow contamination to the water supply. Keep in mind the neck length on tub spouts offset differ, so where the pipe is verses the outlet will matter. I don't know the exact number, but I would expect something in the order of 2" gap to the tub flood rim or so is required.
Some valves, if also used for a shower, require the valve to be within a certain distance of the tub spout to ensure the resistance is less, so it doesn't back up and water flow out the shower when you haven't used the divertor. Many systems have both the path to the showerhead and the spout both open to the valve simultaneously, so the one with the least resistance gets the flow. These details would be in the installation manual of the particular valve you select. If you have a separate divertor valve, rather than using a spout with one, then the distance probably doesn't matter, since a closed valve would prevent water from getting to the showerhead when you didn't want it to.