Comparative index and Sturmian theory for linear Hamiltonian systems