One of the major goals of ecology is to understand the relative importance of the abiotic and biotic environment in determining the distribution and abundance of organisms. For terrestrial plants, it is now generally recognized that both bottom-up effects of the abiotic environment and top-down effects of herbivores and their natural enemies can have important consequences. Much less is understood, however, about how these species interactions are altered under different environmental conditions. In this dissertation, I studied the direct and indirect effects of light availability on the performance of a Neotropical vine with extrafloral nectaries (Passiflora biflora). In one experiment, groups of plants were placed in sunny and shaded areas at a field site in Costa Rica, whereas in a second experiment, light availability was manipulated using three kinds of shade huts (0%, 50%, and 90% shade). By selectively permitting or excluding phytophagous insects and/or ants foraging for extrafloral nectar, I evaluated the strength of these interactions and how their relative importance was altered by shading. In both studies, the direct negative effects of shading and herbivores were clearly seen, but the substantial impact of herbivores was little influenced by light availability. Shading also had little effect on ant visitation, and ants were shown to be ineffective plant bodyguards. Parasitoid and predaceous wasps were also observed visiting extrafloral nectaries; they were little influenced by shading, but unlike ants, wasps were effective defenders against heliconiine caterpillars. Taken together, these experiments found little evidence for indirect effects of shading on plant performance or that the relative importance of direct vs. indirect effects was altered by light availability. For plants in general, I then review what is known about variation in extrafloral nectaries and bodyguard defense, and I organize these prior observations into a general framework for understanding their evolution and phenotypic variation. This framework is defined by three axes of environmental heterogeneity: availability of excess plant resources, risk of plant damage by herbivores, and effectiveness of available plant bodyguards. I conclude by considering a number of ecological and evolutionary predictions that are derived from the proposed framework and suggest several directions for future research.