We explore the shape and the dynamics of scroll-wave filaments in excitable media with an abruptly changing diffusion tensor, important for cardiac applications. We show that, similar to a beam of light, the filament refracts at the boundary separating domains with different diffusion. We derive the laws of filament refraction and test their validity in computational experiments. We discovered that at small angles to the interface, the filament can become unstable and develop oscillations. The nature of the observed instabilities, as well as overall theoretical and experimental significance of the findings, is discussed.