Life in a three-dimensional biofilm is typical for many bacteria, yet little is known about how strains interact in this context. Here, we created essential-gene CRISPRi knockdown libraries in biofilm-forming Bacillus subtilis and measured competitive fitness during colony co-culture with wild type. Partial knockdown of some translation-related genes reduced growth rates and led to out-competition. Media composition led some knockdowns to compete differentially as biofilm versus non-biofilm colonies. Cells depleted for the alanine racemase AlrA died in monoculture but survived in a biofilm-colony co-culture via nutrient sharing. Rescue was enhanced in biofilm-colony co-culture with a matrix-deficient parent, due to a mutualism involving nutrient and matrix sharing. We identified several examples of mutualism involving matrix sharing that occurred in three-dimensional biofilm colonies but not when cultured in two dimensions. Thus, growth in a three-dimensional colony can promote genetic diversity through sharing of secreted factors and may drive evolution of mutualistic behavior.