Load a caulking gun with a tube of flexible acyrlic gap filler. Squeeze the trigger, and inject a bead of the gap filler in the space between the top of the drywall and the wood behind it. Wipe away any excess gap filler from the front of the drywall. Avoid using regular caulking material because it'll crack and break from the wooden beams expanding and contracting. The flexible gap filler will expand and contract with the wood.
Measure the lengths of the drywall for the molding. Cut the required amount of 3/4-inch quarter-round molding strips to these sizes. Paint the molding strips the same color as the walls. Allow to dry before proceeding.
Place the molding strips over the gap between the drywall and the wood. Nail the molding in place with either 4D or 6D finishing nails. Angle the nails when you strike them with the hammer so that you're nailing them to the wooden beams above the drywall and not to the drywall itself. The molding must be able to move with the wooden beams.