The ability to control the formation of interfaces between different materials has become one of the foundations of modern materials science. With the advent of two-dimensional (2D) crystals, low-dimensional equivalents of conventional interfaces can be envisioned: line boundaries separating different materials integrated in a single 2D sheet. Graphene and hexagonal boron nitride offer an attractive system from which to build such 2D heterostructures. They are isostructural, nearly lattice-matched, and isoelectronic, yet their different band structures promise interesting functional properties arising from their integration. Here, we use a combination of in situ microscopy techniques to study the growth and interface formation of monolayer graphene-boron nitride heterostructures on ruthenium. In a sequential chemical vapor deposition process, boron nitride grows preferentially at the edges of existing monolayer graphene domains, which can be exploited for synthesizing continuous 2D membranes of graphene embedded in boron nitride. High-temperature growth leads to intermixing near the interface, similar to interfacial alloying in conventional heterostructures. Using real-time microscopy, we identify processes that eliminate this intermixing and thus pave the way to graphene-boron nitride heterostructures with atomically sharp interfaces.